<!doctype html>



  


<html class="theme-next muse use-motion">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>



<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />












  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  
    
      
    

    
  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Microsoft YaHei:300,300italic,400,400italic,700,700italic|consolas:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.4.0" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.0.2" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="ionic," />








  <link rel="shortcut icon" type="image/x-icon" href="http://ofy7k3v4s.bkt.clouddn.com/mylogo.png?v=5.0.2" />






<meta name="description" content="&amp;#x4EC0;&amp;#x4E48;&amp;#x662F; Ionic JSionic &amp;#x5BF9; AngularJS &amp;#x8FDB;&amp;#x884C;&amp;#x4E86;&amp;#x6269;&amp;#x5C55;&amp;#xFF0C;&amp;#x4E3B;&amp;#x8981;&amp;#x5C31;&amp;#x662F;&amp;#x5C06;&amp;#x79FB;&amp;#x52A8;&amp;#x7AEF;&amp;#x5F00;&amp;#x53D1;&amp;#x4E2D;&amp;#x5E3">
<meta property="og:type" content="article">
<meta property="og:title" content="ionic js笔记">
<meta property="og:url" content="https://hongqinma.github.io/2016/12/09/s016-ionic-js笔记/index.html">
<meta property="og:site_name" content="HongqinMa' Blog">
<meta property="og:description" content="&amp;#x4EC0;&amp;#x4E48;&amp;#x662F; Ionic JSionic &amp;#x5BF9; AngularJS &amp;#x8FDB;&amp;#x884C;&amp;#x4E86;&amp;#x6269;&amp;#x5C55;&amp;#xFF0C;&amp;#x4E3B;&amp;#x8981;&amp;#x5C31;&amp;#x662F;&amp;#x5C06;&amp;#x79FB;&amp;#x52A8;&amp;#x7AEF;&amp;#x5F00;&amp;#x53D1;&amp;#x4E2D;&amp;#x5E3">
<meta property="og:image" content="https://hongqinma.github.io/2016/12/09/s016-ionic-js笔记/ionic17.png">
<meta property="og:image" content="https://hongqinma.github.io/2016/12/09/s016-ionic-js笔记/ionic18.png">
<meta property="og:image" content="https://hongqinma.github.io/2016/12/09/s016-ionic-js笔记/ionic19.png">
<meta property="og:updated_time" content="2016-12-23T01:12:22.788Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="ionic js笔记">
<meta name="twitter:description" content="&amp;#x4EC0;&amp;#x4E48;&amp;#x662F; Ionic JSionic &amp;#x5BF9; AngularJS &amp;#x8FDB;&amp;#x884C;&amp;#x4E86;&amp;#x6269;&amp;#x5C55;&amp;#xFF0C;&amp;#x4E3B;&amp;#x8981;&amp;#x5C31;&amp;#x662F;&amp;#x5C06;&amp;#x79FB;&amp;#x52A8;&amp;#x7AEF;&amp;#x5F00;&amp;#x53D1;&amp;#x4E2D;&amp;#x5E3">
<meta name="twitter:image" content="https://hongqinma.github.io/2016/12/09/s016-ionic-js笔记/ionic17.png">



<script type="text/javascript" id="hexo.configuration">
  var NexT = window.NexT || {};
  var CONFIG = {
    scheme: 'Muse',
    sidebar: {"position":"left","display":"post"},
    fancybox: true,
    motion: true,
    duoshuo: {
      userId: '6347850919329138000',
      author: 'Hiraku'
    }
  };
</script>




  <link rel="canonical" href="https://hongqinma.github.io/2016/12/09/s016-ionic-js笔记/"/>


  <title> ionic js笔记 | HongqinMa' Blog </title>
</head>

<body itemscope itemtype="//schema.org/WebPage" lang="en">

  



  <script type="text/javascript">
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "//hm.baidu.com/hm.js?10010323";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>








  
  
    
  

  <div class="container one-collumn sidebar-position-left page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="//schema.org/WPHeader">
      <div class="header-inner"><div class="site-meta custom-logo">
  
    <div class="site-meta-headline">
      <a>
        <img class="custom-logo-image" src="http://ofy7k3v4s.bkt.clouddn.com/photo.jpg"
             alt="HongqinMa' Blog"/>
      </a>
    </div>
  

  <div class="custom-logo-site-title">
    <a href="/"  class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <span class="site-title">HongqinMa' Blog</span>
      <span class="logo-line-after"><i></i></span>
    </a>
  </div>
  <p class="site-subtitle">Spell at all costs， to rush you in the future。</p>
</div>

<div class="site-nav-toggle">
  <button>
    <span class="btn-bar"></span>
    <span class="btn-bar"></span>
    <span class="btn-bar"></span>
  </button>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            Home
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            Categories
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/about" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br />
            
            About
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            Archives
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            Tags
          </a>
        </li>
      

      
    </ul>
  

  
</nav>

 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  
  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="//schema.org/Article">

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
            
            
              
                ionic js笔记
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">
            <span class="post-meta-item-icon">
              <i class="fa fa-calendar-o"></i>
            </span>
            <span class="post-meta-item-text">Posted on</span>
            <time itemprop="dateCreated" datetime="2016-12-09T22:45:32+08:00" content="2016-12-09">
              2016-12-09
            </time>
          </span>

          
            <span class="post-category" >
              &nbsp; | &nbsp;
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              <span class="post-meta-item-text">In</span>
              
                <span itemprop="about" itemscope itemtype="https://schema.org/Thing">
                  <a href="/categories/Hybrid-APP-开发系列/" itemprop="url" rel="index">
                    <span itemprop="name">Hybrid APP 开发系列</span>
                  </a>
                </span>

                
                

              
            </span>
          

          
            
              <span class="post-comments-count">
                &nbsp; | &nbsp;
                <a href="/2016/12/09/s016-ionic-js笔记/#comments" itemprop="discussionUrl">
                  <span class="post-comments-count ds-thread-count" data-thread-key="2016/12/09/s016-ionic-js笔记/" itemprop="commentsCount"></span>
                </a>
              </span>
            
          

          

          

          
              &nbsp; | &nbsp;
              <span class="page-pv"><i class="fa fa-file-o"></i>
              <span class="busuanzi-value" id="busuanzi_value_page_pv" ></span>
              </span>
          

          
            <span id="busuanzi_container_page_pv">  <span id="busuanzi_value_page_pv"></span> Views</span>
          
        </div>
      </header>
    


    <div class="post-body" itemprop="articleBody">

      
      

      
        <h2 id="&#x4EC0;&#x4E48;&#x662F;-Ionic-JS"><a href="#&#x4EC0;&#x4E48;&#x662F;-Ionic-JS" class="headerlink" title="&#x4EC0;&#x4E48;&#x662F; Ionic JS"></a>&#x4EC0;&#x4E48;&#x662F; Ionic JS</h2><p>ionic &#x5BF9; AngularJS &#x8FDB;&#x884C;&#x4E86;&#x6269;&#x5C55;&#xFF0C;&#x4E3B;&#x8981;&#x5C31;&#x662F;&#x5C06;&#x79FB;&#x52A8;&#x7AEF;&#x5F00;&#x53D1;&#x4E2D;&#x5E38;&#x89C1;&#x7684; UI &#x7EC4;&#x4EF6;&#x62BD;&#x8C61;&#x6210; AngularJS &#x7684;&#x6307;&#x4EE4;&#xFF0C;&#x4FBF;&#x4E8E;&#x6211;&#x4EEC;&#x5728;&#x5F00;&#x53D1;&#x4E2D;&#x5FEB;&#x901F;&#x6784;&#x5EFA;&#x5E94;&#x7528;&#x754C;&#x9762;&#x3002;</p>
<p><img src="/2016/12/09/s016-ionic-js&#x7B14;&#x8BB0;/ionic17.png" alt="Ionic JS"></p>
<h2 id="&#x89C6;&#x56FE;&#x5BFC;&#x822A;"><a href="#&#x89C6;&#x56FE;&#x5BFC;&#x822A;" class="headerlink" title="&#x89C6;&#x56FE;&#x5BFC;&#x822A;"></a>&#x89C6;&#x56FE;&#x5BFC;&#x822A;</h2><h3 id="ion-nav-view"><a href="#ion-nav-view" class="headerlink" title="ion-nav-view"></a>ion-nav-view</h3><p>&#x5728; ionic &#x91CC;&#xFF0C;&#x6211;&#x4EEC;&#x4F7F;&#x7528; ion-nav-view &#x6307;&#x4EE4;&#x4EE3;&#x66FF; AngularUI Route &#x4E2D;&#x7684; ui-view &#x6307;&#x4EE4;&#xFF0C;&#x6765;&#x8FDB;&#x884C;&#x6A21;&#x677F;&#x7684;&#x6E32;&#x67D3;&#xFF1A;</p>
<figure class="highlight html"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line"><span class="tag">&lt;<span class="name">ion-nav-view</span>&gt;</span></div><div class="line"><span class="tag">&lt;/<span class="name">ion-nav-view</span>&gt;</span></div></pre></td></tr></table></figure>
<h3 id="ion-view"><a href="#ion-view" class="headerlink" title="ion-view"></a>ion-view</h3><p>&#x76F8;&#x5F53;&#x4E8E;&#x4E00;&#x4E2A; div &#x91CC;&#x9762;&#x591A;&#x4E86;&#x5F88;&#x591A;&#x5C5E;&#x6027;&#x3002;</p>
<p>cache-view - &#x662F;&#x5426;&#x5BF9;&#x8FD9;&#x4E2A;&#x6A21;&#x677F;&#x89C6;&#x56FE;&#x8FDB;&#x884C;&#x7F13;&#x5B58;</p>
<p>&#x5141;&#x8BB8;&#x503C;&#x4E3A;&#xFF1A;true | false&#xFF0C;&#x9ED8;&#x8BA4;&#x4E3A;true</p>
<figure class="highlight html"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line"><span class="tag">&lt;<span class="name">ion-view</span>&gt;</span></div><div class="line">  ...</div><div class="line"><span class="tag">&lt;/<span class="name">ion-view</span>&gt;</span></div></pre></td></tr></table></figure>
<h2 id="&#x57FA;&#x672C;&#x5E03;&#x5C40;"><a href="#&#x57FA;&#x672C;&#x5E03;&#x5C40;" class="headerlink" title="&#x57FA;&#x672C;&#x5E03;&#x5C40;"></a>&#x57FA;&#x672C;&#x5E03;&#x5C40;</h2><h3 id="Ion-header-bar"><a href="#Ion-header-bar" class="headerlink" title="Ion-header-bar"></a>Ion-header-bar</h3><figure class="highlight html"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line"><span class="tag">&lt;<span class="name">ion-view</span>&gt;</span></div><div class="line">  <span class="tag">&lt;<span class="name">ion-header-bar</span> <span class="attr">class</span>=<span class="string">&quot;title&quot;</span>&gt;</span>&#x5934;&#x90E8;&#x533A;&#x57DF;<span class="tag">&lt;/<span class="name">ion-header-bar</span>&gt;</span></div><div class="line">  <span class="tag">&lt;<span class="name">ion-content</span>&gt;</span>&#x5185;&#x5BB9;&#x533A;&#x57DF;<span class="tag">&lt;/<span class="name">ion-content</span>&gt;</span></div><div class="line">  <span class="tag">&lt;<span class="name">ion-footer-bar</span>&gt;</span>&#x5E95;&#x90E8;<span class="tag">&lt;/<span class="name">ion-footer-bar</span>&gt;</span> </div><div class="line"><span class="tag">&lt;/<span class="name">ion-view</span>&gt;</span></div></pre></td></tr></table></figure>
<p>ion-header-bar &#x6307;&#x4EE4;&#x6709;&#x4E24;&#x4E2A;&#x53EF;&#x9009;&#x7684;&#x5C5E;&#x6027;&#xFF1A;</p>
<blockquote>
<p>align-title - &#x8BBE;&#x7F6E;&#x6807;&#x9898;&#x6587;&#x5B57;&#x7684;&#x5BF9;&#x9F50;&#x65B9;&#x5F0F;&#x3002;&#x5141;&#x8BB8;&#x503C;&#xFF1A;left | right | center&#xFF0C;&#x9ED8;&#x8BA4; center&#x3002;<br>no-tap-scroll - &#x5F53;&#x70B9;&#x51FB;&#x6807;&#x9898;&#x65F6;&#x662F;&#x5426;&#x5C06;&#x5185;&#x5BB9;&#x533A;&#x57DF;&#x81EA;&#x52A8;&#x6EDA;&#x52A8;&#x5230;&#x6700;&#x5F00;&#x59CB;&#x3002;&#x5141;&#x8BB8;&#x503C;&#xFF1A;true | false&#xFF0C;&#x9ED8;&#x8BA4;&#x4E3A; true&#x3002;</p>
</blockquote>
<h3 id="ion-footer-bar"><a href="#ion-footer-bar" class="headerlink" title="ion-footer-bar"></a>ion-footer-bar</h3><figure class="highlight html"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line"><span class="tag">&lt;<span class="name">ion-footer-bar</span>&gt;</span>...<span class="tag">&lt;/<span class="name">ion-footer-bar</span>&gt;</span></div></pre></td></tr></table></figure>
<p>ion-footer-bar&#x6307;&#x4EE4;&#x6709;&#x4E00;&#x4E2A;&#x53EF;&#x9009;&#x7684;&#x5C5E;&#x6027;&#xFF1A;</p>
<blockquote>
<p>align-title - &#x8BBE;&#x7F6E;&#x6807;&#x9898;&#x6587;&#x672C;&#x7684;&#x5BF9;&#x9F50;&#x65B9;&#x5F0F;&#x3002;&#x5141;&#x8BB8;&#x503C;&#xFF1A;left | right | center &#x3002;</p>
</blockquote>
<h3 id="ion-content"><a href="#ion-content" class="headerlink" title="ion-content"></a>ion-content</h3><figure class="highlight html"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line"><span class="tag">&lt;<span class="name">ion-content</span>&gt;</span>...<span class="tag">&lt;/<span class="name">ion-content</span>&gt;</span></div></pre></td></tr></table></figure>
<blockquote>
<p>ion-content&#x5360;&#x636E; header &#x548C; footer &#x4EE5;&#x5916;&#x7684;&#x5269;&#x4F59;&#x533A;&#x57DF;&#x3002;&#x5F53;&#x5185;&#x5BB9;&#x8D85;&#x8FC7;&#x53EF;&#x89C6;&#x533A;&#x57DF;&#x65F6;&#xFF0C;ion-content &#x53EF;&#x4EE5;&#x6EDA;&#x52A8;&#x4EE5;&#x663E;&#x793A;&#x88AB;&#x9690;&#x85CF;&#x7684;&#x90E8;&#x5206;&#x3002;<br>&#x9ED8;&#x8BA4; ionic &#x81EA;&#x5B9A;&#x5236;&#x7684;&#x6EDA;&#x52A8;&#x89C6;&#x56FE;&#xFF0C;&#x53EF;&#x4EE5;&#x4F7F;&#x7528; overflow-scroll &#x5C5E;&#x6027;&#x8BBE;&#x7F6E;&#x4F7F;&#x7528;&#x7CFB;&#x7EDF;&#x5185;&#x7F6E;&#x7684;&#x6EDA;&#x52A8;&#x6761;&#x3002;</p>
</blockquote>
<h2 id="&#x9009;&#x9879;&#x5361;"><a href="#&#x9009;&#x9879;&#x5361;" class="headerlink" title="&#x9009;&#x9879;&#x5361;"></a>&#x9009;&#x9879;&#x5361;</h2><h3 id="&#x8BED;&#x6CD5;"><a href="#&#x8BED;&#x6CD5;" class="headerlink" title="&#x8BED;&#x6CD5;"></a>&#x8BED;&#x6CD5;</h3><figure class="highlight html"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line"><span class="tag">&lt;<span class="name">ion-tabs</span>&gt;</span></div><div class="line">  <span class="tag">&lt;<span class="name">ion-tab</span> <span class="attr">title</span>=<span class="string">&quot;...&quot;</span>&gt;</span>...<span class="tag">&lt;/<span class="name">ion-tab</span>&gt;</span></div><div class="line">  <span class="tag">&lt;<span class="name">ion-tab</span> <span class="attr">title</span>=<span class="string">&quot;...&quot;</span>&gt;</span>...<span class="tag">&lt;/<span class="name">ion-tab</span>&gt;</span></div><div class="line">  ...</div><div class="line"><span class="tag">&lt;/<span class="name">ion-tabs</span>&gt;</span></div></pre></td></tr></table></figure>
<p>&#x6CE8;&#x610F;&#xFF1A;</p>
<blockquote>
<p>&#x4E0D;&#x8981;&#x628A; ion-tabs &#x6307;&#x4EE4;&#x653E;&#x5728; ion-content &#x4E4B;&#x5185;<br>ion-tab &#x7684;&#x5185;&#x5BB9;&#x5E94;&#x5F53;&#x653E;&#x5165; ion-view &#x6307;&#x4EE4;&#x5185;&#xFF0C;&#x5426;&#x5219; ionic &#x5728;&#x8BA1;&#x7B97;&#x5E03;&#x5C40;&#x65F6;&#x53EF;&#x80FD;&#x51FA;&#x9519;</p>
</blockquote>
<p><img src="/2016/12/09/s016-ionic-js&#x7B14;&#x8BB0;/ionic18.png" alt="&#x9009;&#x9879;&#x5361;"></p>
<h3 id="&#x811A;&#x672C;&#x63A5;&#x53E3;&#xFF1A;-ionicTabsDelegate"><a href="#&#x811A;&#x672C;&#x63A5;&#x53E3;&#xFF1A;-ionicTabsDelegate" class="headerlink" title="&#x811A;&#x672C;&#x63A5;&#x53E3;&#xFF1A;$ionicTabsDelegate"></a>&#x811A;&#x672C;&#x63A5;&#x53E3;&#xFF1A;$ionicTabsDelegate</h3><blockquote>
<p>select(index) - &#x9009;&#x4E2D;&#x6307;&#x5B9A;&#x7684;&#x9009;&#x9879;&#x9875;</p>
</blockquote>
<p>index&#x53C2;&#x6570;&#x4ECE;0&#x5F00;&#x59CB;&#xFF0C;&#x7B2C;&#x4E00;&#x4E2A;&#x9009;&#x9879;&#x9875;&#x7684;index&#x4E3A;0&#xFF0C;&#x7B2C;&#x4E8C;&#x4E2A;&#x4E3A;1&#xFF0C;&#x4F9D;&#x6B21;&#x7C7B;&#x63A8;&#x3002;</p>
<blockquote>
<p>selectedIndex() - &#x8FD4;&#x56DE;&#x5F53;&#x524D;&#x9009;&#x4E2D;&#x9009;&#x9879;&#x9875;&#x7684;&#x7D22;&#x5F15;&#x53F7;</p>
</blockquote>
<p>&#x5982;&#x679C;&#x5F53;&#x524D;&#x6CA1;&#x6709;&#x9009;&#x4E2D;&#x7684;&#x9009;&#x9879;&#x9875;&#xFF0C;&#x5219;&#x8FD4;&#x56DE; -1&#x3002;</p>
<h2 id="&#x5217;&#x8868;"><a href="#&#x5217;&#x8868;" class="headerlink" title="&#x5217;&#x8868;"></a>&#x5217;&#x8868;</h2><h3 id="&#x8BED;&#x6CD5;-1"><a href="#&#x8BED;&#x6CD5;-1" class="headerlink" title="&#x8BED;&#x6CD5;"></a>&#x8BED;&#x6CD5;</h3><p>&#x5217;&#x8868;&#x662F;&#x5E38;&#x7528;&#x7684;&#x4FE1;&#x606F;&#x7EC4;&#x7EC7;&#x65B9;&#x5F0F;</p>
<figure class="highlight html"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line"><span class="tag">&lt;<span class="name">ion-list</span>&gt;</span></div><div class="line">  <span class="tag">&lt;<span class="name">ion-item</span>&gt;</span>...<span class="tag">&lt;/<span class="name">ion-item</span>&gt;</span></div><div class="line">  <span class="tag">&lt;<span class="name">ion-item</span>&gt;</span>...<span class="tag">&lt;/<span class="name">ion-item</span>&gt;</span></div><div class="line">  ...</div><div class="line"><span class="tag">&lt;/<span class="name">ion-list</span>&gt;</span></div></pre></td></tr></table></figure>
<h3 id="&#x5C5E;&#x6027;"><a href="#&#x5C5E;&#x6027;" class="headerlink" title="&#x5C5E;&#x6027;"></a>&#x5C5E;&#x6027;</h3><blockquote>
<p>type - &#x5217;&#x8868;&#x79CD;&#x7C7B;</p>
</blockquote>
<p>type &#x5C5E;&#x6027;&#x662F;&#x53EF;&#x9009;&#x7684;&#xFF0C;&#x53EF;&#x7528;&#x6765;&#x8BBE;&#x7F6E;&#x5217;&#x8868;&#x7684;&#x79CD;&#x7C7B;&#xFF1A; list-inset | card&#x3002;&#x8FD9;&#x4E24;&#x79CD;&#x5217;&#x8868;&#x90FD;&#x4EA7;&#x751F;&#x5185;&#x5D4C;&#x7684;&#x6548;&#x679C;&#xFF0C;&#x533A;&#x522B;&#x5728;&#x4E8E;card&#x5217;&#x8868;&#x6709;&#x8FB9;&#x6846;&#x7684;&#x9634;&#x5F71;&#x6548;&#x679C;&#x3002;</p>
<blockquote>
<p>show-delete - &#x662F;&#x5426;&#x663E;&#x793A;&#x6210;&#x5458;&#x5185;&#x7684;delete&#x6309;&#x94AE;</p>
</blockquote>
<p>show-delete &#x5C5E;&#x6027;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002;&#x5982;&#x679C;&#x5728;&#x6210;&#x5458;&#x5185;&#x6709; delete &#x6309;&#x94AE;&#xFF08;ion-delete-button&#xFF09;&#xFF0C;&#x4F7F;&#x7528;&#x8FD9;&#x4E2A;&#x5C5E;&#x6027;&#x6765;&#x901A;&#x77E5;&#x5217;&#x8868;&#x662F;&#x5426;&#x663E;&#x793A;&#x5143;&#x7D20;&#x5220;&#x9664;&#x6309;&#x94AE;&#x3002;&#x5141;&#x8BB8;&#x7684;&#x503C;&#x4E3A;&#xFF1A;true | false&#x3002;</p>
<blockquote>
<p>show-reorder - &#x662F;&#x5426;&#x663E;&#x793A;&#x6210;&#x5458;&#x5185;&#x7684;reorder&#x6309;&#x94AE;</p>
</blockquote>
<p>show-reorder &#x5C5E;&#x6027;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002;&#x5982;&#x679C;&#x5728;&#x6210;&#x5458;&#x5185;&#x6709;reorder&#x6309;&#x94AE;&#xFF08;ion-reorder-button&#xFF09;&#xFF0C;&#x4F7F;&#x7528;&#x8FD9;&#x4E2A;&#x5C5E;&#x6027;&#x6765;&#x901A;&#x77E5;&#x5217;&#x8868;&#x662F;&#x5426;&#x663E;&#x793A;&#x5143;&#x7D20;&#x91CD;&#x6392;&#x5E8F;&#x6309;&#x94AE;&#x3002;&#x5141;&#x8BB8;&#x7684;&#x503C;&#x4E3A;&#xFF1A;true | false</p>
<blockquote>
<p>can-swipe - &#x662F;&#x5426;&#x652F;&#x6301;&#x6ED1;&#x52A8;&#x65B9;&#x5F0F;&#x663E;&#x793A;&#x6210;&#x5458;option&#x6309;&#x94AE;</p>
</blockquote>
<p>can-swipe &#x5C5E;&#x6027;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002;&#x5982;&#x679C;&#x5728;&#x6210;&#x5458;&#x5185;&#x6709;option&#x6309;&#x94AE;&#xFF08;ion-option-button&#xFF09;&#xFF0C;&#x4F7F;&#x7528;&#x8FD9;&#x4E2A;&#x5C5E;&#x6027;&#x6765;&#x5141;&#x8BB8;&#x6216;&#x7981;&#x6B62;&#x901A;&#x8FC7;&#x5411;&#x5DE6;&#x6ED1;&#x52A8;&#x6210;&#x5458;&#x6765;&#x6253;&#x5F00;option&#x6309;&#x94AE;&#x3002;&#x5141;&#x8BB8;&#x7684;&#x503C;&#x4E3A;&#xFF1A;true | false &#xFF0C;&#x9ED8;&#x8BA4;&#x4E3A;true&#x3002;</p>
<h3 id="&#x6210;&#x5458;&#x6309;&#x94AE;"><a href="#&#x6210;&#x5458;&#x6309;&#x94AE;" class="headerlink" title="&#x6210;&#x5458;&#x6309;&#x94AE;"></a>&#x6210;&#x5458;&#x6309;&#x94AE;</h3><blockquote>
<p>ion-option-button - &#x9009;&#x9879;&#x6309;&#x94AE;&#x3002;</p>
</blockquote>
<p>&#x4E00;&#x4E2A;ion-item&#x5185;&#x53EF;&#x4EE5;&#x5305;&#x542B;&#x591A;&#x4E2A;&#x9009;&#x9879;&#x6309;&#x94AE;&#x3002;&#x9009;&#x9879;&#x6309;&#x94AE;&#x662F;&#x9690;&#x85CF;&#x7684;&#xFF0C;&#x9700;&#x8981;&#x7528;&#x6237;&#x5411;&#x5DE6; &#x6ED1;&#x52A8;&#x6210;&#x5458;&#xFF0C;&#x4EE5;&#x663E;&#x793A;&#x9009;&#x9879;&#x6309;&#x94AE;&#x3002;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;ion-tabs&#x7684;can-swipe&#x5C5E;&#x6027;&#x5141;&#x8BB8;&#x6216;&#x7981;&#x6B62; &#x6ED1;&#x52A8;&#x5F00;&#x542F;&#x9009;&#x9879;&#x6309;&#x94AE;&#x3002;</p>
<blockquote>
<p>ion-delete-button - &#x5220;&#x9664;&#x6309;&#x94AE;</p>
</blockquote>
<p>&#x4E00;&#x4E2A;ion-item&#x5185;&#x6700;&#x591A;&#x6709;&#x4E00;&#x4E2A;&#x5220;&#x9664;&#x6309;&#x94AE;&#x3002;&#x5220;&#x9664;&#x6309;&#x94AE;&#x5728;&#x663E;&#x793A;&#x65F6;&#x603B;&#x662F;&#x4F4D;&#x4E8E;&#x6210;&#x5458;&#x7684;&#x6700; &#x5DE6;&#x7AEF;&#x3002;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;ion-tabs&#x7684;show-delete&#x5C5E;&#x6027;&#x663E;&#x793A;&#x6216;&#x9690;&#x85CF;&#x5220;&#x9664;&#x6309;&#x94AE;</p>
<blockquote>
<p>ion-reorder-button - &#x91CD;&#x6392;&#x6309;&#x94AE;</p>
</blockquote>
<p>&#x4E00;&#x4E2A;ion-item&#x5185;&#x6700;&#x591A;&#x6709;&#x4E00;&#x4E2A;&#x91CD;&#x6392;&#x6309;&#x94AE;&#x3002;&#x91CD;&#x6392;&#x6309;&#x94AE;&#x5728;&#x663E;&#x793A;&#x65F6;&#x603B;&#x662F;&#x4F4D;&#x4E8E;&#x6210;&#x5458;&#x7684;&#x6700; &#x53F3;&#x7AEF;&#x3002;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;ion-tabs&#x7684;show-reorder&#x5C5E;&#x6027;&#x663E;&#x793A;&#x6216;&#x9690;&#x85CF;&#x91CD;&#x6392;&#x6309;&#x94AE;</p>
<h3 id="API-ionicListDelegate"><a href="#API-ionicListDelegate" class="headerlink" title="API : $ionicListDelegate"></a>API : $ionicListDelegate</h3><p>&#x5982;&#x679C;&#x9700;&#x8981;&#x4ECE;&#x811A;&#x672C;&#x4E2D;&#x63A7;&#x5236;&#x5217;&#x8868;&#x5143;&#x7D20;&#xFF0C;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;$ionicListDelegate&#x670D;&#x52A1;&#xFF1A;</p>
<blockquote>
<p>showReorder([showReorder]) - &#x663E;&#x793A;/&#x5173;&#x95ED;&#x6392;&#x5E8F;&#x6309;&#x94AE;</p>
</blockquote>
<p>showReorder&#x7684;&#x5141;&#x8BB8;&#x503C;&#x4E3A;&#xFF1A;true | false&#x3002;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x4E00;&#x4E2A;&#x4F5C;&#x7528;&#x57DF;&#x4E0A;&#x7684;&#x8868;&#x8FBE;&#x5F0F;</p>
<blockquote>
<p>showDelete([showDelete]) - &#x663E;&#x793A;/&#x5173;&#x95ED;&#x5220;&#x9664;&#x6309;&#x94AE;</p>
</blockquote>
<p>showDelete&#x7684;&#x5141;&#x8BB8;&#x503C;&#x4E3A;&#xFF1A; true | false&#x3002;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x4E00;&#x4E2A;&#x4F5C;&#x7528;&#x57DF;&#x4E0A;&#x7684;&#x8868;&#x8FBE;&#x5F0F;</p>
<blockquote>
<p>canSwipeItems([canSwipeItems]) - &#x662F;&#x5426;&#x5141;&#x8BB8;&#x901A;&#x8FC7;&#x6ED1;&#x52A8;&#x65B9;&#x5F0F;&#x6765;&#x663E;&#x793A;&#x6210;&#x5458;&#x9009;&#x9879;&#x6309;&#x94AE;</p>
</blockquote>
<p>canSwipeItems&#x7684;&#x5141;&#x8BB8;&#x503C;&#x4E3A;&#xFF1A;true | false&#x3002;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x4E00;&#x4E2A;&#x4F5C;&#x7528;&#x57DF;&#x4E0A;&#x7684;&#x8868;&#x8FBE;&#x5F0F;</p>
<blockquote>
<p>closeOptionButtons() - &#x5173;&#x95ED;&#x6240;&#x6709;&#x9009;&#x9879;&#x6309;&#x94AE;</p>
</blockquote>
<h2 id="&#x8868;&#x5355;&#x8F93;&#x5165;"><a href="#&#x8868;&#x5355;&#x8F93;&#x5165;" class="headerlink" title="&#x8868;&#x5355;&#x8F93;&#x5165;"></a>&#x8868;&#x5355;&#x8F93;&#x5165;</h2><h3 id="&#x590D;&#x9009;&#x6309;&#x94AE;-ion-checkbox"><a href="#&#x590D;&#x9009;&#x6309;&#x94AE;-ion-checkbox" class="headerlink" title="&#x590D;&#x9009;&#x6309;&#x94AE;: ion-checkbox"></a>&#x590D;&#x9009;&#x6309;&#x94AE;: ion-checkbox</h3><figure class="highlight html"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line"><span class="tag">&lt;<span class="name">ion-checkbox</span>&gt;</span>...<span class="tag">&lt;/<span class="name">ion-checkbox</span>&gt;</span></div></pre></td></tr></table></figure>
<p>1&#x3001;&#x4F7F;&#x7528; ion-checkbox &#x6307;&#x4EE4;&#x58F0;&#x660E;&#x590D;&#x9009;&#x6309;&#x94AE;&#x5143;&#x7D20;&#xFF1A;</p>
<blockquote>
<p>&#x4E0E;&#x6807;&#x51C6;&#x7684;checkbox&#x76F8;&#x6BD4;&#xFF0C;&#x4F7F;&#x7528;ionic&#x7684;ion-checkbox&#x6709;&#x51E0;&#x4E2A;&#x4F18;&#x52BF;&#xFF1A;<br>&#x6837;&#x5F0F;&#x66F4;&#x7F8E;&#x89C2;&#xFF0C;&#x4E0E;&#x79FB;&#x52A8;&#x7AEF;&#x7684;UI&#x66F4;&#x5339;&#x914D;<br>&#x652F;&#x6301;&#x6570;&#x636E;&#x7ED1;&#x5B9A;&#x3002;&#x4F7F;&#x7528;&#x53EF;&#x9009;&#x7684;ng-model&#x5C5E;&#x6027;&#xFF0C;&#x53EF;&#x4EE5;&#x76F4;&#x63A5;&#x5C06;&#x9009;&#x4E2D;&#x72B6;&#x6001;&#x7ED1;&#x5B9A;&#x5230;&#x4F5C;&#x7528;&#x57DF;&#x4E0A;&#x7684;&#x53D8;&#x91CF;<br>&#x76F4;&#x63A5;&#x4F7F;&#x7528;&#x6587;&#x672C;&#x5B50;&#x5143;&#x7D20;&#x4F5C;&#x4E3A;&#x6807;&#x7B7E;</p>
</blockquote>
<p>2&#x3001;&#x4E5F;&#x53EF;&#x4EE5;&#x4F7F;&#x7528; ng-checked &#x8FDB;&#x884C;&#x624B;&#x52A8;&#x7684;&#x72B6;&#x6001;&#x9009;&#x5B9A;</p>
<h3 id="&#x5355;&#x9009;&#x6309;&#x94AE;-ion-radio"><a href="#&#x5355;&#x9009;&#x6309;&#x94AE;-ion-radio" class="headerlink" title="&#x5355;&#x9009;&#x6309;&#x94AE;:ion-radio"></a>&#x5355;&#x9009;&#x6309;&#x94AE;:ion-radio</h3><figure class="highlight html"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line"><span class="tag">&lt;<span class="name">ion-radio</span>&gt;</span>...<span class="tag">&lt;/<span class="name">ion-radio</span>&gt;</span></div></pre></td></tr></table></figure>
<p>&#x548C; HTML &#x7684; radio &#x76F8;&#x6BD4;&#xFF0C;ion-radio &#x7684;&#x6539;&#x8FDB;&#x4E5F;&#x662F;&#x660E;&#x663E;&#x7684;&#xFF1A;</p>
<blockquote>
<p>1&#x3001;&#x4E0E;&#x79FB;&#x52A8;&#x7AEF;&#x7684; UI &#x66F4;&#x5339;&#x914D;<br>2&#x3001;&#x4F7F;&#x7528;&#x53EF;&#x9009;&#x7684; ng-model &#x5C5E;&#x6027;&#xFF0C;&#x5B9E;&#x73B0;&#x4E0E;&#x4F5C;&#x7528;&#x57DF;&#x53D8;&#x91CF;&#x7684;&#x6570;&#x636E;&#x7ED1;&#x5B9A;<br>3&#x3001;&#x4F7F;&#x7528;&#x53EF;&#x9009;&#x7684; ng-value &#x5C5E;&#x6027;&#xFF0C;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x4F5C;&#x7528;&#x57DF;&#x53D8;&#x91CF;&#x8BBE;&#x7F6E;&#x5355;&#x9009;&#x6309;&#x94AE;&#x5BF9;&#x5E94;&#x7684;&#x503C;</p>
</blockquote>
<h3 id="&#x5F00;&#x5173;&#x6309;&#x94AE;-ion-toggle"><a href="#&#x5F00;&#x5173;&#x6309;&#x94AE;-ion-toggle" class="headerlink" title="&#x5F00;&#x5173;&#x6309;&#x94AE;:ion-toggle"></a>&#x5F00;&#x5173;&#x6309;&#x94AE;:ion-toggle</h3><figure class="highlight html"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line"><span class="tag">&lt;<span class="name">ion-toggle</span>&gt;</span><span class="tag">&lt;/<span class="name">ion-toggle</span>&gt;</span></div></pre></td></tr></table></figure>
<p>ion-toggle &#x6709;&#x4E24;&#x4E2A;&#x53EF;&#x9009;&#x7684;&#x5C5E;&#x6027;&#xFF1A;</p>
<blockquote>
<p>ng-model - &#x6A21;&#x578B;&#x53D8;&#x91CF;</p>
</blockquote>
<p>&#x548C;&#x590D;&#x9009;&#x6309;&#x94AE;&#x4E00;&#x6837;&#xFF0C;&#x5F00;&#x5173;&#x6309;&#x94AE;&#x4E5F;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x53EF;&#x9009;&#x7684;ng-model&#x5C5E;&#x6027;&#x5B9E;&#x73B0;&#x4E0E;&#x4F5C;&#x7528;&#x57DF;&#x53D8;&#x91CF; &#x7684;&#x53CC;&#x5411;&#x7ED1;&#x5B9A;&#x3002;</p>
<blockquote>
<p>toggle-class - &#x6837;&#x5F0F;&#x7C7B;</p>
</blockquote>
<p>&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x53EF;&#x9009;&#x7684; toggle-class &#x5C5E;&#x6027;&#x4E3A;&#x5F00;&#x5173;&#x6309;&#x94AE;&#x58F0;&#x660E;&#x989D;&#x5916;&#x7684;&#x6837;&#x5F0F;&#x3002;&#x6BD4;&#x5982;&#xFF1A;toggle-{color} &#x7528;&#x6765;&#x58F0;&#x660E;&#x914D;&#x8272;&#x65B9;&#x6848;&#x3002;</p>
<h2 id="&#x6548;&#x679C;&#x56FE;"><a href="#&#x6548;&#x679C;&#x56FE;" class="headerlink" title="&#x6548;&#x679C;&#x56FE;"></a>&#x6548;&#x679C;&#x56FE;</h2><p><img src="/2016/12/09/s016-ionic-js&#x7B14;&#x8BB0;/ionic19.png" alt="&#x6548;&#x679C;&#x56FE;"></p>
<h2 id="&#x4EE3;&#x7801;"><a href="#&#x4EE3;&#x7801;" class="headerlink" title="&#x4EE3;&#x7801;"></a>&#x4EE3;&#x7801;</h2><p>controller.js</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">$scope.select = {</div><div class="line">  <span class="attr">select</span>: <span class="string">&apos;&apos;</span></div><div class="line">}</div></pre></td></tr></table></figure>
<p>html &#x9875;&#x9762;</p>
<figure class="highlight html"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div></pre></td><td class="code"><pre><div class="line"><span class="tag">&lt;<span class="name">ion-view</span>&gt;</span></div><div class="line">  <span class="tag">&lt;<span class="name">ion-header-bar</span> <span class="attr">align-title</span>=<span class="string">&quot;center&quot;</span> <span class="attr">class</span>=<span class="string">&quot;royal-bg bar bar-header &quot;</span>&gt;</span>&#x5934;&#x90E8;&#x533A;&#x57DF;<span class="tag">&lt;/<span class="name">ion-header-bar</span>&gt;</span></div><div class="line">  <span class="tag">&lt;<span class="name">ion-content</span> <span class="attr">class</span>=<span class="string">&quot;light-bg&quot;</span>&gt;</span></div><div class="line">    <span class="tag">&lt;<span class="name">ion-list</span>&gt;</span></div><div class="line">      <span class="tag">&lt;<span class="name">ion-item</span>&gt;</span></div><div class="line">        &#x7C7B;&#x4F3C;&#x4E8E; QQ &#x7684;&#x529F;&#x80FD;</div><div class="line">        <span class="tag">&lt;<span class="name">ion-option-button</span> <span class="attr">class</span>=<span class="string">&quot;assertive-bg&quot;</span>&gt;</span>&#x5220;&#x9664;<span class="tag">&lt;/<span class="name">ion-option-button</span>&gt;</span></div><div class="line">        <span class="tag">&lt;<span class="name">ion-option-button</span> <span class="attr">class</span>=<span class="string">&quot;balanced-bg&quot;</span>&gt;</span>&#x6DFB;&#x52A0;<span class="tag">&lt;/<span class="name">ion-option-button</span>&gt;</span></div><div class="line">      <span class="tag">&lt;/<span class="name">ion-item</span>&gt;</span></div><div class="line">      <span class="tag">&lt;<span class="name">ion-item</span>&gt;</span>&#x590D;&#x9009;&#x6309;&#x94AE;&#x7684;&#x72B6;&#x6001;&#x662F;&#xFF1A;{{ck}} <span class="tag">&lt;<span class="name">br</span>/&gt;</span><span class="tag">&lt;<span class="name">br</span>/&gt;</span></div><div class="line">        <span class="tag">&lt;<span class="name">ion-checkbox</span> <span class="attr">ng-model</span>=<span class="string">&quot;ck&quot;</span>&gt;</span>&#x590D;&#x9009;&#x6309;&#x94AE;<span class="tag">&lt;/<span class="name">ion-checkbox</span>&gt;</span></div><div class="line">      <span class="tag">&lt;/<span class="name">ion-item</span>&gt;</span></div><div class="line">      <span class="tag">&lt;<span class="name">ion-item</span>&gt;</span>&#x5F00;&#x5173;&#x7684;&#x72B6;&#x6001;&#x662F;&#xFF1A;{{tg}} <span class="tag">&lt;<span class="name">br</span>/&gt;</span><span class="tag">&lt;<span class="name">br</span>/&gt;</span></div><div class="line">        <span class="tag">&lt;<span class="name">ion-toggle</span> <span class="attr">ng-model</span>=<span class="string">&quot;tg&quot;</span>&gt;</span>&#x5F00;&#x5173;<span class="tag">&lt;/<span class="name">ion-toggle</span>&gt;</span></div><div class="line">      <span class="tag">&lt;/<span class="name">ion-item</span>&gt;</span></div><div class="line">      <span class="tag">&lt;<span class="name">ion-item</span>&gt;</span>&#x5355;&#x9009;&#x6309;&#x94AE;&#x7684;&#x9009;&#x4E2D;&#x503C;&#x662F;&#xFF1A;{{select.select}} <span class="tag">&lt;<span class="name">br</span>/&gt;</span><span class="tag">&lt;<span class="name">br</span>/&gt;</span></div><div class="line">        <span class="tag">&lt;<span class="name">ion-radio</span> <span class="attr">ng-repeat</span>=<span class="string">&quot;item in data&quot;</span> <span class="attr">ng-model</span>=<span class="string">&quot;select.select&quot;</span> <span class="attr">ng-value</span>=<span class="string">&quot;item.value&quot;</span>&gt;</span>{{item.name}}<span class="tag">&lt;/<span class="name">ion-radio</span>&gt;</span></div><div class="line">      <span class="tag">&lt;/<span class="name">ion-item</span>&gt;</span></div><div class="line">      <span class="tag">&lt;<span class="name">ion-item</span>&gt;</span>&#x5217;&#x8868;4<span class="tag">&lt;/<span class="name">ion-item</span>&gt;</span></div><div class="line">    <span class="tag">&lt;/<span class="name">ion-list</span>&gt;</span></div><div class="line">  <span class="tag">&lt;/<span class="name">ion-content</span>&gt;</span></div><div class="line">  <span class="tag">&lt;<span class="name">ion-footer-bar</span> <span class="attr">class</span>=<span class="string">&quot;dark-bg&quot;</span>&gt;</span>&#x5E95;&#x90E8;<span class="tag">&lt;/<span class="name">ion-footer-bar</span>&gt;</span></div><div class="line"><span class="tag">&lt;/<span class="name">ion-view</span>&gt;</span></div></pre></td></tr></table></figure>
<h2 id="&#x5E7B;&#x706F;&#x7247;"><a href="#&#x5E7B;&#x706F;&#x7247;" class="headerlink" title="&#x5E7B;&#x706F;&#x7247;"></a>&#x5E7B;&#x706F;&#x7247;</h2><h3 id="&#x8BED;&#x6CD5;-2"><a href="#&#x8BED;&#x6CD5;-2" class="headerlink" title="&#x8BED;&#x6CD5;"></a>&#x8BED;&#x6CD5;</h3><figure class="highlight html"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line"><span class="tag">&lt;<span class="name">ion-slide-box</span>&gt;</span></div><div class="line"><span class="tag">&lt;<span class="name">ion-slide</span>&gt;</span>...<span class="tag">&lt;/<span class="name">ion-slide</span>&gt;</span></div><div class="line"><span class="tag">&lt;<span class="name">ion-slide</span>&gt;</span>...<span class="tag">&lt;/<span class="name">ion-slide</span>&gt;</span></div><div class="line">...</div><div class="line"><span class="tag">&lt;/<span class="name">ion-slide-box</span>&gt;</span></div></pre></td></tr></table></figure>
<h3 id="&#x5C5E;&#x6027;-1"><a href="#&#x5C5E;&#x6027;-1" class="headerlink" title="&#x5C5E;&#x6027;"></a>&#x5C5E;&#x6027;</h3><blockquote>
<p>does-continue - &#x662F;&#x5426;&#x5FAA;&#x73AF;&#x5207;&#x6362;</p>
</blockquote>
<p>&#x5F00;&#x5934;&#x7684;&#x5E7B;&#x706F;&#x9875;&#x53EA;&#x80FD;&#x5411;&#x5DE6;&#x6ED1;&#x52A8;&#xFF0C;&#x6700;&#x540E;&#x7684;&#x5E7B;&#x706F;&#x9875;&#x53EA;&#x80FD;&#x5411;&#x53F3;&#x6ED1;&#x52A8;&#x3002; &#x5C06;does-continue&#x5C5E;&#x6027;&#x503C;&#x8BBE;&#x4E3A;true&#xFF0C;&#x5C31;&#x53EF;&#x4EE5;&#x8BA9;&#x5E7B;&#x706F;&#x9875;&#x7EC4;&#x9996;&#x5C3E;&#x8FDE;&#x63A5;&#x8D77;&#x6765;&#xFF0C;&#x5FAA;&#x73AF;&#x5207;&#x6362;&#x3002;</p>
<blockquote>
<p>auto-play - &#x662F;&#x5426;&#x81EA;&#x52A8;&#x64AD;&#x653E;</p>
</blockquote>
<p>&#x901A;&#x8FC7;&#x5C06;auto-play&#x5C5E;&#x6027;&#x8BBE;&#x7F6E;&#x4E3A;true&#xFF0C;&#x53EF;&#x4EE5;&#x8BA9;&#x5E7B;&#x706F;&#x9875;&#x81EA;&#x52A8;&#x5207;&#x6362;&#x3002;&#x5207;&#x6362;&#x7684;&#x95F4;&#x9694;&#x9ED8;&#x8BA4;&#x662F;4000ms&#xFF0C;&#x53EF;&#x4EE5; &#x901A;&#x8FC7;&#x5C5E;&#x6027;slide-interval&#x8FDB;&#x884C;&#x8C03;&#x6574;&#x3002;</p>
<blockquote>
<p>slide-interval - &#x81EA;&#x52A8;&#x64AD;&#x653E;&#x7684;&#x95F4;&#x9694;&#x65F6;&#x95F4;&#xFF0C;&#x9ED8;&#x8BA4;&#x4E3A;4000ms<br>show-pager - &#x662F;&#x5426;&#x663E;&#x793A;&#x5206;&#x9875;&#x5668;</p>
</blockquote>
<p>&#x5206;&#x9875;&#x5668;&#x7528;&#x6765;&#x6307;&#x793A;&#x5E7B;&#x706F;&#x9875;&#x7684;&#x9009;&#x4E2D;&#x72B6;&#x6001;&#xFF0C;&#x4F4D;&#x4E8E;&#x5E7B;&#x706F;&#x7247;&#x7684;&#x5E95;&#x90E8;&#x3002; &#x5141;&#x8BB8;&#x503C;&#x4E3A;&#xFF1A;true | false</p>
<h3 id="&#x65B9;&#x6CD5;&#x4E8B;&#x4EF6;"><a href="#&#x65B9;&#x6CD5;&#x4E8B;&#x4EF6;" class="headerlink" title="&#x65B9;&#x6CD5;&#x4E8B;&#x4EF6;"></a>&#x65B9;&#x6CD5;&#x4E8B;&#x4EF6;</h3><blockquote>
<p>pager-click - &#x5206;&#x9875;&#x5668;&#x70B9;&#x51FB;&#x4E8B;&#x4EF6;<br>pager-click &#x5C5E;&#x6027;&#x5E94;&#x5F53;&#x8BBE;&#x7F6E;&#x4E3A;&#x4E00;&#x4E2A;&#x5F53;&#x524D;&#x4F5C;&#x7528;&#x57DF;&#x4E0A;&#x7684;&#x51FD;&#x6570;&#x8C03;&#x7528;&#x8868;&#x8FBE;&#x5F0F;&#xFF0C;&#x8FD9;&#x4E2A;&#x51FD;&#x6570;&#x5C06;&#x88AB; &#x4F20;&#x5165;&#x88AB;&#x70B9;&#x51FB;&#x7684;&#x5206;&#x9875;&#x6309;&#x94AE;&#x5BF9;&#x5E94;&#x7684;&#x5E7B;&#x706F;&#x9875;&#x5E8F;&#x53F7;&#xFF1A;index<br>on-slide-changed - &#x5E7B;&#x706F;&#x9875;&#x5207;&#x6362;&#x4E8B;&#x4EF6;<br>on-slide-changed&#x5C5E;&#x6027;&#x5E94;&#x5F53;&#x8BBE;&#x7F6E;&#x4E3A;&#x4E00;&#x4E2A;&#x5F53;&#x524D;&#x4F5C;&#x7528;&#x57DF;&#x4E0A;&#x7684;&#x51FD;&#x6570;&#x8C03;&#x7528;&#x8868;&#x8FBE;&#x5F0F;&#xFF0C;&#x8FD9;&#x4E2A;&#x51FD;&#x6570; &#x5C06;&#x88AB;&#x4F20;&#x5165;&#x5F53;&#x524D;&#x5E7B;&#x706F;&#x9875;&#x7684;&#x5E8F;&#x53F7;&#xFF1A;$index<br>active-slide - &#x5F53;&#x524D;&#x5E7B;&#x706F;&#x9875;&#x7D22;&#x5F15;<br>active-slide &#x5C5E;&#x6027;&#x5E94;&#x5F53;&#x8BBE;&#x7F6E;&#x4E3A;&#x4E00;&#x4E2A;&#x5F53;&#x524D;&#x4F5C;&#x7528;&#x57DF;&#x4E0A;&#x7684;&#x53D8;&#x91CF;&#xFF0C;&#x5F53;&#x5E7B;&#x706F;&#x7247;&#x5207;&#x6362;&#x65F6;&#xFF0C;&#x8FD9;&#x4E2A;&#x53D8; &#x91CF;&#x540C;&#x6B65;&#x7684;&#x53CD;&#x5E94;&#x5F53;&#x524D;&#x7684;&#x5E7B;&#x706F;&#x9875;&#x7D22;&#x5F15;&#x53F7;</p>
</blockquote>
<h3 id="API-ionicSlideBoxDelegate"><a href="#API-ionicSlideBoxDelegate" class="headerlink" title="API:$ionicSlideBoxDelegate"></a>API:$ionicSlideBoxDelegate</h3><blockquote>
<p>update() - &#x91CD;&#x7ED8;&#x5E7B;&#x706F;&#x7247;</p>
</blockquote>
<p>&#x6709;&#x65F6;&#xFF0C;&#x6BD4;&#x5982;&#x5F53;&#x5BB9;&#x5668;&#x5C3A;&#x5BF8;&#x53D1;&#x751F;&#x53D8;&#x5316;&#x65F6;&#xFF0C;&#x9700;&#x8981;&#x8C03;&#x7528;update()&#x65B9;&#x6CD5;&#x91CD;&#x7ED8;&#x5E7B;&#x706F;&#x7247;&#x3002;</p>
<blockquote>
<p>slide(to[,speed]) - &#x5207;&#x6362;&#x5230;&#x6307;&#x5B9A;&#x5E7B;&#x706F;&#x9875;</p>
</blockquote>
<p>&#x53C2;&#x6570;to&#x8868;&#x793A;&#x5207;&#x6362;&#x7684;&#x76EE;&#x6807;&#x5E7B;&#x706F;&#x9875;&#x5E8F;&#x53F7;&#xFF0C;&#x53C2;&#x6570;speed&#x662F;&#x53EF;&#x9009;&#x7684;&#xFF0C;&#x8868;&#x793A;&#x4EE5;&#x6BEB;&#x79D2; &#x4E3A;&#x5355;&#x4F4D;&#x7684;&#x5207;&#x6362;&#x65F6;&#x95F4;</p>
<blockquote>
<p>previous() - &#x5207;&#x6362;&#x5230;&#x524D;&#x4E00;&#x5F20;&#x5E7B;&#x706F;&#x9875;<br>next() - &#x5207;&#x6362;&#x5230;&#x540E;&#x4E00;&#x5F20;&#x5E7B;&#x706F;&#x9875;<br>currentIndex() - &#x83B7;&#x5F97;&#x5F53;&#x524D;&#x5E7B;&#x706F;&#x9875;&#x7684;&#x5E8F;&#x53F7;<br>slideCount() - &#x83B7;&#x5F97;&#x5168;&#x90E8;&#x5E7B;&#x706F;&#x9875;&#x7684;&#x6570;&#x91CF;</p>
</blockquote>
<h2 id="&#x52A8;&#x6001;&#x7EC4;&#x4EF6;"><a href="#&#x52A8;&#x6001;&#x7EC4;&#x4EF6;" class="headerlink" title="&#x52A8;&#x6001;&#x7EC4;&#x4EF6;"></a>&#x52A8;&#x6001;&#x7EC4;&#x4EF6;</h2><h3 id="&#x6A21;&#x6001;&#x5BF9;&#x8BDD;&#x6846;-ionicModal"><a href="#&#x6A21;&#x6001;&#x5BF9;&#x8BDD;&#x6846;-ionicModal" class="headerlink" title="&#x6A21;&#x6001;&#x5BF9;&#x8BDD;&#x6846;:$ionicModal"></a>&#x6A21;&#x6001;&#x5BF9;&#x8BDD;&#x6846;:$ionicModal</h3><p>&#x6A21;&#x6001;&#x5BF9;&#x8BDD;&#x6846;&#x5E38;&#x7528;&#x6765;&#x4F9B;&#x7528;&#x6237;&#x8FDB;&#x884C;&#x9009;&#x62E9;&#x6216;&#x7F16;&#x8F91;&#xFF0C;&#x5728;&#x6A21;&#x6001;&#x5BF9;&#x8BDD;&#x6846;&#x5173;&#x95ED;&#x4E4B;&#x524D;&#xFF0C;&#x5176;&#x4ED6; &#x7684;&#x7528;&#x6237;&#x4EA4;&#x4E92;&#x884C;&#x4E3A;&#x88AB;&#x963B;&#x6B62;&#x3002;</p>
<p>&#x5728;ionic&#x4E2D;&#x4F7F;&#x7528;&#x6A21;&#x6001;&#x5BF9;&#x8BDD;&#x6846;&#x6709;&#x4E09;&#x4E2A;&#x6B65;&#x9AA4;&#xFF1A;</p>
<h4 id="1&#x3001;&#x58F0;&#x660E;&#x5BF9;&#x8BDD;&#x6846;&#x6A21;&#x677F;"><a href="#1&#x3001;&#x58F0;&#x660E;&#x5BF9;&#x8BDD;&#x6846;&#x6A21;&#x677F;" class="headerlink" title="1&#x3001;&#x58F0;&#x660E;&#x5BF9;&#x8BDD;&#x6846;&#x6A21;&#x677F;"></a>1&#x3001;&#x58F0;&#x660E;&#x5BF9;&#x8BDD;&#x6846;&#x6A21;&#x677F;</h4><p>&#x4F7F;&#x7528;ion-modal-view&#x6307;&#x4EE4;&#x58F0;&#x660E;&#x5BF9;&#x8BDD;&#x6846;&#x6A21;&#x677F;&#xFF0C;&#x5BF9;&#x8BDD;&#x6846;&#x6A21;&#x677F;&#x901A;&#x5E38;&#x7F6E;&#x5165; script &#x5185;&#x4EE5;&#x6784;&#x9020;&#x5185;&#x8054;&#x6A21;&#x677F;&#xFF1A;</p>
<figure class="highlight html"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line"><span class="tag">&lt;<span class="name">script</span> <span class="attr">id</span>=<span class="string">&quot;a.html&quot;</span> <span class="attr">type</span>=<span class="string">&quot;text/ng-template&quot;</span>&gt;</span><span class="xml"></span></div><div class="line">    <span class="tag">&lt;<span class="name">ion-modal-view</span>&gt;</span></div><div class="line">        <span class="comment">&lt;!--&#x5BF9;&#x8BDD;&#x6846;&#x5185;&#x5BB9;--&gt;</span></div><div class="line">    <span class="tag">&lt;/<span class="name">ion-modal-view</span>&gt;</span></div><div class="line"><span class="tag">&lt;/<span class="name">script</span>&gt;</span></div></pre></td></tr></table></figure>
<h4 id="2&#x3001;&#x521B;&#x5EFA;&#x5BF9;&#x8BDD;&#x6846;&#x5BF9;&#x8C61;"><a href="#2&#x3001;&#x521B;&#x5EFA;&#x5BF9;&#x8BDD;&#x6846;&#x5BF9;&#x8C61;" class="headerlink" title="2&#x3001;&#x521B;&#x5EFA;&#x5BF9;&#x8BDD;&#x6846;&#x5BF9;&#x8C61;"></a>2&#x3001;&#x521B;&#x5EFA;&#x5BF9;&#x8BDD;&#x6846;&#x5BF9;&#x8C61;</h4><p>&#x670D;&#x52A1;$ionicModal&#x6709;&#x4E24;&#x4E2A;&#x65B9;&#x6CD5;&#x7528;&#x6765;&#x521B;&#x5EFA;&#x5BF9;&#x8BDD;&#x6846;&#x5BF9;&#x8C61;&#xFF1A;</p>
<blockquote>
<p>fromTemplate(templateString,options) - &#x4F7F;&#x7528;&#x5B57;&#x7B26;&#x4E32;&#x6A21;&#x677F;<br>fromTemplateUrl(templateUrl,options) - &#x4F7F;&#x7528;&#x5185;&#x8054;&#x6A21;&#x677F;</p>
</blockquote>
<p>&#x8FD9;&#x4E24;&#x4E2A;&#x65B9;&#x6CD5;&#x8FD4;&#x56DE;&#x7684;&#x90FD;&#x662F;&#x4E00;&#x4E2A;&#x5BF9;&#x8BDD;&#x6846;&#x5BF9;&#x8C61;&#x3002;</p>
<h4 id="3&#x3001;&#x64CD;&#x4F5C;&#x5BF9;&#x8BDD;&#x6846;&#x5BF9;&#x8C61;"><a href="#3&#x3001;&#x64CD;&#x4F5C;&#x5BF9;&#x8BDD;&#x6846;&#x5BF9;&#x8C61;" class="headerlink" title="3&#x3001;&#x64CD;&#x4F5C;&#x5BF9;&#x8BDD;&#x6846;&#x5BF9;&#x8C61;"></a>3&#x3001;&#x64CD;&#x4F5C;&#x5BF9;&#x8BDD;&#x6846;&#x5BF9;&#x8C61;</h4><p>&#x5BF9;&#x8C61;&#x6846;&#x5BF9;&#x8C61;&#x6709;&#x4EE5;&#x4E0B;&#x65B9;&#x6CD5;&#x7528;&#x4E8E;&#x663E;&#x793A;&#x3001;&#x9690;&#x85CF;&#x6216;&#x5220;&#x9664;&#x5BF9;&#x8BDD;&#x6846;&#xFF1A;</p>
<blockquote>
<p>show() - &#x663E;&#x793A;&#x5BF9;&#x8BDD;&#x6846;<br>hide() - &#x9690;&#x85CF;&#x5BF9;&#x8BDD;&#x6846;<br>remove() - &#x79FB;&#x9664;&#x5BF9;&#x8BDD;&#x6846;<br>isShown() - &#x5BF9;&#x8BDD;&#x6846;&#x662F;&#x5426;&#x53EF;&#x89C6;&#xFF1F;</p>
</blockquote>
<h4 id="4&#x3001;js&#x4EE3;&#x7801;"><a href="#4&#x3001;js&#x4EE3;&#x7801;" class="headerlink" title="4&#x3001;js&#x4EE3;&#x7801;"></a>4&#x3001;js&#x4EE3;&#x7801;</h4><figure class="highlight js"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div></pre></td><td class="code"><pre><div class="line">angular.module(<span class="string">&apos;testApp&apos;</span>, [<span class="string">&apos;ionic&apos;</span>])</div><div class="line">.controller(<span class="string">&apos;MyController&apos;</span>, <span class="function"><span class="keyword">function</span>(<span class="params">$scope, $ionicModal</span>) </span>{</div><div class="line">  $ionicModal.fromTemplateUrl(<span class="string">&apos;modal.html&apos;</span>, {</div><div class="line">    <span class="attr">scope</span>: $scope,</div><div class="line">    <span class="attr">animation</span>: <span class="string">&apos;slide-in-up&apos;</span></div><div class="line">  }).then(<span class="function"><span class="keyword">function</span>(<span class="params">modal</span>) </span>{</div><div class="line">    $scope.modal = modal;</div><div class="line">  });</div><div class="line">  $scope.openModal = <span class="function"><span class="keyword">function</span>(<span class="params"></span>) </span>{</div><div class="line">    $scope.modal.show();</div><div class="line">  };</div><div class="line">  $scope.closeModal = <span class="function"><span class="keyword">function</span>(<span class="params"></span>) </span>{</div><div class="line">    $scope.modal.hide();</div><div class="line">  };</div><div class="line">  <span class="comment">//&#x5F53;&#x6211;&#x4EEC;&#x7528;&#x5230;&#x6A21;&#x578B;&#x65F6;&#xFF0C;&#x6E05;&#x9664;&#x5B83;&#xFF01;</span></div><div class="line">  $scope.$on(<span class="string">&apos;$destroy&apos;</span>, <span class="function"><span class="keyword">function</span>(<span class="params"></span>) </span>{</div><div class="line">    $scope.modal.remove();</div><div class="line">  });</div><div class="line">  <span class="comment">// &#x5F53;&#x9690;&#x85CF;&#x7684;&#x6A21;&#x578B;&#x65F6;&#x6267;&#x884C;&#x52A8;&#x4F5C;</span></div><div class="line">  $scope.$on(<span class="string">&apos;modal.hide&apos;</span>, <span class="function"><span class="keyword">function</span>(<span class="params"></span>) </span>{</div><div class="line">    <span class="comment">// &#x6267;&#x884C;&#x52A8;&#x4F5C;</span></div><div class="line">  });</div><div class="line">  <span class="comment">// &#x5F53;&#x79FB;&#x52A8;&#x6A21;&#x578B;&#x65F6;&#x6267;&#x884C;&#x52A8;&#x4F5C;</span></div><div class="line">  $scope.$on(<span class="string">&apos;modal.removed&apos;</span>, <span class="function"><span class="keyword">function</span>(<span class="params"></span>) </span>{</div><div class="line">    <span class="comment">// &#x6267;&#x884C;&#x52A8;&#x4F5C;</span></div><div class="line">  });</div><div class="line">});</div></pre></td></tr></table></figure>
<h3 id="&#x4E0A;&#x62C9;&#x83DC;&#x5355;-ionicActionSheet"><a href="#&#x4E0A;&#x62C9;&#x83DC;&#x5355;-ionicActionSheet" class="headerlink" title="&#x4E0A;&#x62C9;&#x83DC;&#x5355;:$ionicActionSheet"></a>&#x4E0A;&#x62C9;&#x83DC;&#x5355;:$ionicActionSheet</h3><p>1&#x3001;&#x5B9A;&#x4E49;&#x4E0A;&#x62C9;&#x83DC;&#x5355;&#x9009;&#x9879;</p>
<p>&#x83DC;&#x5355;&#x5C5E;&#x6027;&#xFF1A;</p>
<blockquote>
<p>titleText - &#x4E0A;&#x62C9;&#x83DC;&#x5355;&#x7684;&#x6807;&#x9898;&#x6587;&#x672C;<br>buttons - &#x81EA;&#x5B9A;&#x4E49;&#x6309;&#x94AE;&#x6570;&#x7EC4;&#x3002;&#x6BCF;&#x4E2A;&#x6309;&#x94AE;&#x9700;&#x8981;&#x4E00;&#x4E2A;&#x63CF;&#x8FF0;&#x5BF9;&#x8C61;&#xFF0C;&#x5176;text&#x5B57;&#x6BB5;&#x7528;&#x4E8E;&#x6309;&#x94AE;&#x663E;&#x793A;<br>cancelText - &#x53D6;&#x6D88;&#x6309;&#x94AE;&#x7684;&#x6587;&#x672C;&#x3002;&#x5982;&#x679C;&#x4E0D;&#x8BBE;&#x7F6E;&#x6B64;&#x5B57;&#x6BB5;&#xFF0C;&#x5219;&#x4E0A;&#x62C9;&#x83DC;&#x5355;&#x4E2D;&#x4E0D;&#x51FA;&#x73B0;&#x53D6;&#x6D88;&#x6309;&#x94AE;<br>destructiveText - &#x5371;&#x9669;&#x9009;&#x9879;&#x6309;&#x94AE;&#x7684;&#x6587;&#x672C;&#x3002;&#x5982;&#x679C;&#x4E0D;&#x8BBE;&#x7F6E;&#x6B64;&#x5B57;&#x6BB5;&#xFF0C;&#x5219;&#x4E0A;&#x62C9;&#x83DC;&#x5355;&#x4E2D;&#x4E0D;&#x51FA;&#x73B0;&#x5371;&#x9669;&#x9009;&#x9879;&#x6309;&#x94AE;<br>buttonClicked - &#x81EA;&#x5B9A;&#x4E49;&#x6309;&#x94AE;&#x7684;&#x56DE;&#x8C03;&#x51FD;&#x6570;&#xFF0C;&#x5F53;&#x7528;&#x6237;&#x70B9;&#x51FB;&#x65F6;&#x89E6;&#x53D1;<br>cancel - &#x53D6;&#x6D88;&#x6309;&#x94AE;&#x56DE;&#x8C03;&#x51FD;&#x6570;&#xFF0C;&#x5F53;&#x7528;&#x6237;&#x70B9;&#x51FB;&#x65F6;&#x89E6;&#x53D1;<br>destructiveButtonClicked - &#x5371;&#x9669;&#x9009;&#x9879;&#x6309;&#x94AE;&#x7684;&#x56DE;&#x8C03;&#x51FD;&#x6570;&#xFF0C;&#x5F53;&#x7528;&#x6237;&#x70B9;&#x51FB;&#x65F6;&#x89E6;&#x53D1;<br>cancelOnStateChange - &#x5F53;&#x5207;&#x6362;&#x5230;&#x65B0;&#x7684;&#x89C6;&#x56FE;&#x65F6;&#x662F;&#x5426;&#x5173;&#x95ED;&#x6B64;&#x4E0A;&#x62C9;&#x83DC;&#x5355;&#x3002;&#x9ED8;&#x8BA4;&#x4E3A;true<br>cssClass - &#x9644;&#x52A0;&#x7684;CSS&#x6837;&#x5F0F;&#x7C7B;&#x540D;&#x79F0;</p>
</blockquote>
<p>2&#x3001;&#x521B;&#x5EFA;&#x4E0A;&#x62C9;&#x83DC;&#x5355;</p>
<p>$ionicActionSheet &#x670D;&#x52A1;&#x7684; show() &#x65B9;&#x6CD5;&#x7528;&#x6765;&#x521B;&#x5EFA;&#x4E0A;&#x62C9;&#x83DC;&#x5355;&#xFF0C;&#x8FD4;&#x56DE;&#x4E00;&#x4E2A;&#x51FD;&#x6570;&#xFF0C;&#x8C03;&#x7528;&#x8BE5; &#x8FD4;&#x56DE;&#x51FD;&#x6570;&#x53EF;&#x4EE5;&#x5173;&#x95ED;&#x6B64;&#x83DC;&#x5355;&#x3002;</p>
<p>3&#x3001;&#x4EE3;&#x7801;</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div></pre></td><td class="code"><pre><div class="line">angular.module(<span class="string">&apos;mySuperApp&apos;</span>, [<span class="string">&apos;ionic&apos;</span>])</div><div class="line">  .controller(<span class="function"><span class="keyword">function</span>(<span class="params">$scope, $ionicActionSheet</span>) </span>{</div><div class="line">      <span class="comment">// &#x70B9;&#x51FB;&#x6309;&#x94AE;&#x89E6;&#x53D1;&#xFF0C;&#x6216;&#x4E00;&#x4E9B;&#x5176;&#x4ED6;&#x7684;&#x89E6;&#x53D1;&#x6761;&#x4EF6;</span></div><div class="line">      $scope.show = <span class="function"><span class="keyword">function</span>(<span class="params"></span>) </span>{</div><div class="line">          <span class="comment">// &#x663E;&#x793A;&#x64CD;&#x4F5C;&#x8868;</span></div><div class="line">          $ionicActionSheet.show({</div><div class="line">              <span class="attr">buttons</span>: [</div><div class="line">                 { <span class="attr">text</span>: <span class="string">&apos;&lt;b&gt;Share&lt;/b&gt; This&apos;</span> },</div><div class="line">                 { <span class="attr">text</span>: <span class="string">&apos;Move&apos;</span> },</div><div class="line">              ],</div><div class="line">              <span class="attr">destructiveText</span>: <span class="string">&apos;Delete&apos;</span>,</div><div class="line">              <span class="attr">titleText</span>: <span class="string">&apos;Modify your album&apos;</span>,</div><div class="line">              <span class="attr">cancelText</span>: <span class="string">&apos;Cancel&apos;</span>,</div><div class="line">              <span class="attr">buttonClicked</span>: <span class="function"><span class="keyword">function</span>(<span class="params">index</span>) </span>{</div><div class="line">                  <span class="keyword">switch</span> (index) {</div><div class="line">                     <span class="keyword">case</span> <span class="number">0</span>: <span class="built_in">console</span>.log(<span class="string">&apos;&#x76F8;&#x673A;&apos;</span>);</div><div class="line">                           <span class="keyword">break</span>;</div><div class="line">                     <span class="keyword">case</span> <span class="number">1</span>:</div><div class="line">                       <span class="built_in">console</span>.log(<span class="string">&apos;&#x56FE;&#x5E93;&apos;</span>);</div><div class="line">                           <span class="keyword">break</span>;</div><div class="line">                   }</div><div class="line">                  <span class="keyword">return</span> <span class="literal">true</span>;</div><div class="line">              }</div><div class="line">          });</div><div class="line">      };</div><div class="line">  });</div></pre></td></tr></table></figure>
<h3 id="&#x5F39;&#x51FA;&#x6846;-ionicPopup"><a href="#&#x5F39;&#x51FA;&#x6846;-ionicPopup" class="headerlink" title="&#x5F39;&#x51FA;&#x6846;:$ionicPopup"></a>&#x5F39;&#x51FA;&#x6846;:$ionicPopup</h3><p>&#x8BED;&#x6CD5;&#xFF1A;</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line">$ionicPopup.show(options)</div><div class="line">.then(<span class="function"><span class="keyword">function</span>(<span class="params"></span>)</span>{</div><div class="line">    <span class="comment">//&#x8FD9;&#x4E2A;&#x51FD;&#x6570;&#x5728;&#x5F39;&#x51FA;&#x6846;&#x5173;&#x95ED;&#x65F6;&#x88AB;&#x8C03;&#x7528;</span></div><div class="line">});</div></pre></td></tr></table></figure>
<p>&#x7B80;&#x5316;&#x7684;&#x7279;&#x5B9A;&#x5F39;&#x51FA;&#x6846;&#xFF1A;</p>
<blockquote>
<p>alert(options) - &#x8B66;&#x544A;&#x5F39;&#x51FA;&#x6846;&#xFF0C;&#x4EC5;&#x5305;&#x542B;&#x4E00;&#x4E2A;&#x6309;&#x94AE;&#x4F9B;&#x5173;&#x95ED;&#x5F39;&#x51FA;&#x6846;<br>confirm(options) - &#x786E;&#x8BA4;&#x5F39;&#x51FA;&#x6846;&#xFF0C;&#x5305;&#x542B;&#x4E00;&#x4E2A;&#x53D6;&#x6D88;&#x6309;&#x94AE;&#x548C;&#x4E00;&#x4E2A;&#x786E;&#x8BA4;&#x6309;&#x94AE;<br>prompt(options) - &#x8F93;&#x5165;&#x63D0;&#x793A;&#x5F39;&#x51FA;&#x6846;&#xFF0C;&#x5305;&#x542B;&#x4E00;&#x4E2A;&#x6587;&#x672C;&#x8F93;&#x5165;&#x6846;&#x3001;&#x4E00;&#x4E2A;&#x53D6;&#x6D88;</p>
</blockquote>
<p>js&#x4EE3;&#x7801;</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div><div class="line">36</div><div class="line">37</div><div class="line">38</div><div class="line">39</div><div class="line">40</div><div class="line">41</div><div class="line">42</div><div class="line">43</div><div class="line">44</div><div class="line">45</div><div class="line">46</div><div class="line">47</div><div class="line">48</div><div class="line">49</div><div class="line">50</div><div class="line">51</div><div class="line">52</div><div class="line">53</div><div class="line">54</div><div class="line">55</div><div class="line">56</div><div class="line">57</div><div class="line">58</div><div class="line">59</div><div class="line">60</div></pre></td><td class="code"><pre><div class="line">angular.module(<span class="string">&apos;mySuperApp&apos;</span>, [<span class="string">&apos;ionic&apos;</span>])</div><div class="line">.controller(<span class="function"><span class="keyword">function</span>(<span class="params">$scope, $ionicPopup, $timeout</span>) </span>{</div><div class="line"> <span class="comment">// &#x89E6;&#x53D1;&#x4E00;&#x4E2A;&#x6309;&#x94AE;&#x70B9;&#x51FB;&#xFF0C;&#x6216;&#x4E00;&#x4E9B;&#x5176;&#x4ED6;&#x76EE;&#x6807;</span></div><div class="line"> $scope.showPopup = <span class="function"><span class="keyword">function</span>(<span class="params"></span>) </span>{</div><div class="line">   $scope.data = {}</div><div class="line">   <span class="comment">// &#x4E00;&#x4E2A;&#x7CBE;&#x5FC3;&#x5236;&#x4F5C;&#x7684;&#x81EA;&#x5B9A;&#x4E49;&#x5F39;&#x7A97;</span></div><div class="line">   <span class="keyword">var</span> myPopup = $ionicPopup.show({</div><div class="line">     <span class="attr">template</span>: <span class="string">&apos;&lt;input type=&quot;password&quot; ng-model=&quot;data.wifi&quot;&gt;&apos;</span>,</div><div class="line">     <span class="attr">title</span>: <span class="string">&apos;Enter Wi-Fi Password&apos;</span>,</div><div class="line">     <span class="attr">subTitle</span>: <span class="string">&apos;Please use normal things&apos;</span>,</div><div class="line">     <span class="attr">scope</span>: $scope,</div><div class="line">     <span class="attr">buttons</span>: [</div><div class="line">       { <span class="attr">text</span>: <span class="string">&apos;Cancel&apos;</span> },</div><div class="line">       {</div><div class="line">         <span class="attr">text</span>: <span class="string">&apos;&lt;b&gt;Save&lt;/b&gt;&apos;</span>,</div><div class="line">         <span class="attr">type</span>: <span class="string">&apos;button-positive&apos;</span>,</div><div class="line">         <span class="attr">onTap</span>: <span class="function"><span class="keyword">function</span>(<span class="params">e</span>) </span>{</div><div class="line">           <span class="keyword">if</span> (!$scope.data.wifi) {</div><div class="line">             <span class="comment">//&#x4E0D;&#x5141;&#x8BB8;&#x7528;&#x6237;&#x5173;&#x95ED;&#xFF0C;&#x9664;&#x975E;&#x4ED6;&#x952E;&#x5165;wifi&#x5BC6;&#x7801;</span></div><div class="line">             e.preventDefault();</div><div class="line">           } <span class="keyword">else</span> {</div><div class="line">             <span class="keyword">return</span> $scope.data.wifi;</div><div class="line">           }</div><div class="line">         }</div><div class="line">       },</div><div class="line">     ]</div><div class="line">   });</div><div class="line">   myPopup.then(<span class="function"><span class="keyword">function</span>(<span class="params">res</span>) </span>{</div><div class="line">     <span class="built_in">console</span>.log(<span class="string">&apos;Tapped!&apos;</span>, res);</div><div class="line">   });</div><div class="line">   $timeout(<span class="function"><span class="keyword">function</span>(<span class="params"></span>) </span>{</div><div class="line">      myPopup.close(); <span class="comment">//&#x7531;&#x4E8E;&#x67D0;&#x79CD;&#x539F;&#x56E0;3&#x79D2;&#x540E;&#x5173;&#x95ED;&#x5F39;&#x51FA;</span></div><div class="line">   }, <span class="number">3000</span>);</div><div class="line"></div><div class="line">   <span class="comment">// &#x4E00;&#x4E2A;&#x786E;&#x8BA4;&#x5BF9;&#x8BDD;&#x6846;</span></div><div class="line">   $scope.showConfirm = <span class="function"><span class="keyword">function</span>(<span class="params"></span>) </span>{</div><div class="line">     <span class="keyword">var</span> confirmPopup = $ionicPopup.confirm({</div><div class="line">       <span class="attr">title</span>: <span class="string">&apos;Consume Ice Cream&apos;</span>,</div><div class="line">       <span class="attr">template</span>: <span class="string">&apos;Are you sure you want to eat this ice cream?&apos;</span></div><div class="line">     });</div><div class="line">     confirmPopup.then(<span class="function"><span class="keyword">function</span>(<span class="params">res</span>) </span>{</div><div class="line">       <span class="keyword">if</span>(res) {</div><div class="line">         <span class="built_in">console</span>.log(<span class="string">&apos;You are sure&apos;</span>);</div><div class="line">       } <span class="keyword">else</span> {</div><div class="line">         <span class="built_in">console</span>.log(<span class="string">&apos;You are not sure&apos;</span>);</div><div class="line">       }</div><div class="line">     });</div><div class="line">   };</div><div class="line">   <span class="comment">// &#x4E00;&#x4E2A;&#x63D0;&#x793A;&#x5BF9;&#x8BDD;&#x6846;</span></div><div class="line">   $scope.showAlert = <span class="function"><span class="keyword">function</span>(<span class="params"></span>) </span>{</div><div class="line">     <span class="keyword">var</span> alertPopup = $ionicPopup.alert({</div><div class="line">       <span class="attr">title</span>: <span class="string">&apos;Don\&apos;t eat that!&apos;</span>,</div><div class="line">       <span class="attr">template</span>: <span class="string">&apos;It might taste good&apos;</span></div><div class="line">     });</div><div class="line">     alertPopup.then(<span class="function"><span class="keyword">function</span>(<span class="params">res</span>) </span>{</div><div class="line">       <span class="built_in">console</span>.log(<span class="string">&apos;Thank you for not eating my delicious ice cream cone&apos;</span>);</div><div class="line">     });</div><div class="line">   };</div><div class="line"> };</div><div class="line">});</div></pre></td></tr></table></figure>
<h3 id="&#x6D6E;&#x52A8;&#x6846;&#xFF1A;-ionicPopover"><a href="#&#x6D6E;&#x52A8;&#x6846;&#xFF1A;-ionicPopover" class="headerlink" title="&#x6D6E;&#x52A8;&#x6846;&#xFF1A;$ionicPopover"></a>&#x6D6E;&#x52A8;&#x6846;&#xFF1A;$ionicPopover</h3><p>&#x6D6E;&#x52A8;&#x6846;&#x901A;&#x5E38;&#x7528;&#x4EE5;&#x975E;&#x4FB5;&#x5165;&#x7684;&#x65B9;&#x5F0F;&#x63D0;&#x4F9B;&#x5F53;&#x524D;&#x89C6;&#x56FE;&#x7684;&#x989D;&#x5916;&#x4FE1;&#x606F;&#x3002;</p>
<p>&#x5728; ionic &#x4E2D;&#x4F7F;&#x7528;&#x6D6E;&#x52A8;&#x6846;&#x7684;&#x51E0;&#x4E2A;&#x6B65;&#x9AA4;&#xFF1A;</p>
<p>1.&#x58F0;&#x660E;&#x6A21;&#x677F;</p>
<p>&#x9700;&#x8981;&#x9996;&#x5148;&#x5229;&#x7528; ion-popover-view &#x6307;&#x4EE4;&#x58F0;&#x660E;&#x4E00;&#x4E2A;&#x6A21;&#x677F;&#x5185;&#x5BB9;&#xFF1A;</p>
<figure class="highlight html"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line"><span class="tag">&lt;<span class="name">ion-popover-view</span>&gt;</span></div><div class="line">    <span class="comment">&lt;!--&#x6A21;&#x677F;&#x5185;&#x5BB9;--&gt;</span></div><div class="line"><span class="tag">&lt;/<span class="name">ion-popover-view</span>&gt;</span></div></pre></td></tr></table></figure>
<p>2.&#x521B;&#x5EFA;&#x6D6E;&#x52A8;&#x6846;&#x5BF9;&#x8C61;</p>
<p>&#x4F7F;&#x7528;$ion-popover&#x670D;&#x52A1;&#x7684;&#x4EE5;&#x4E0B;&#x65B9;&#x6CD5;&#x521B;&#x5EFA;&#x6D6E;&#x52A8;&#x6846;&#x5BF9;&#x8C61;&#xFF1A;</p>
<blockquote>
<p>fromTemplate(templateString,options) - &#x4F7F;&#x7528;&#x6A21;&#x677F;&#x5B57;&#x7B26;&#x4E32;&#x6784;&#x9020;&#x6D6E;&#x52A8;&#x6846;<br>fromTemplateurl(templateUrl,options) - &#x4F7F;&#x7528;&#x5185;&#x8054;&#x6A21;&#x677F;&#x6784;&#x9020;&#x6D6E;&#x52A8;&#x6846;</p>
</blockquote>
<p>&#x6CE8;&#x610F;&#xFF1A;&#x8FD9;&#x4E24;&#x4E2A;&#x65B9;&#x6CD5;&#x8FD4;&#x56DE;&#x7684;&#x90FD;&#x662F;promise&#x5BF9;&#x8C61;&#xFF0C;&#x5728;&#x6D6E;&#x52A8;&#x6846;&#x5BF9;&#x8C61;&#x88AB;&#x6784;&#x9020; &#x6210;&#x529F;&#x540E;&#x5F97;&#x5230;&#x89E3;&#x6790;&#xFF0C;&#x8FD9;&#x65F6;&#x53EF;&#x4EE5;&#x83B7;&#x53D6;&#x6D6E;&#x52A8;&#x6846;&#x5BF9;&#x8C61;&#xFF1A;</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line">$ionicPopover.fromTemplate(...)</div><div class="line"> .then(<span class="function"><span class="keyword">function</span>(<span class="params">popover</span>)</span>{</div><div class="line">     <span class="comment">//popover&#x53C2;&#x6570;&#x662F;&#x6D6E;&#x52A8;&#x6846;&#x5BF9;&#x8C61;</span></div><div class="line">});</div></pre></td></tr></table></figure>
<p>3.&#x64CD;&#x4F5C;&#x6D6E;&#x52A8;&#x6846;&#x5BF9;&#x8C61;</p>
<p>&#x6D6E;&#x52A8;&#x6846;&#x5BF9;&#x8C61;&#x63D0;&#x4F9B;&#x4EE5;&#x4E0B;&#x65B9;&#x6CD5;&#xFF1A;</p>
<blockquote>
<p>show() - &#x663E;&#x793A;&#x6D6E;&#x52A8;&#x6846;<br>hide() - &#x5173;&#x95ED;&#x6D6E;&#x52A8;&#x6846;<br>remove() - &#x79FB;&#x9664;&#x6D6E;&#x52A8;&#x6846;<br>isShown() - &#x6D6E;&#x52A8;&#x6846;&#x662F;&#x5426;&#x5904;&#x4E8E;&#x663E;&#x793A;&#x72B6;&#x6001;&#xFF1F;</p>
</blockquote>
<p>4.&#x4EE3;&#x7801;</p>
<blockquote>
<p>&#x9875;&#x9762;&#x90E8;&#x5206;</p>
</blockquote>
<figure class="highlight html"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line"><span class="tag">&lt;<span class="name">script</span> <span class="attr">id</span>=<span class="string">&quot;ez-popover.html&quot;</span> <span class="attr">type</span>=<span class="string">&quot;text/ng-template&quot;</span>&gt;</span><span class="xml"></span></div><div class="line">  <span class="tag">&lt;<span class="name">ion-popover-view</span> <span class="attr">class</span>=<span class="string">&quot;calm-bg light padding&quot;</span>&gt;</span></div><div class="line">    <span class="tag">&lt;<span class="name">p</span>&gt;</span>&#x8FD9;&#x91CC;&#x5E94;&#x8BE5;&#x6709;&#x4E9B;&#x5E2E;&#x52A9;&#x4FE1;&#x606F;....<span class="tag">&lt;/<span class="name">p</span>&gt;</span></div><div class="line">  <span class="tag">&lt;/<span class="name">ion-popover-view</span>&gt;</span></div><div class="line"><span class="tag">&lt;/<span class="name">script</span>&gt;</span></div></pre></td></tr></table></figure>
<blockquote>
<p>&#x63A7;&#x5236;&#x5668;&#x90E8;&#x5206;</p>
</blockquote>
<figure class="highlight js"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div></pre></td><td class="code"><pre><div class="line">angular.module(<span class="string">&quot;ezApp&quot;</span>, [<span class="string">&quot;ionic&quot;</span>])</div><div class="line">.controller(<span class="string">&quot;ezCtrl&quot;</span>, <span class="function"><span class="keyword">function</span>(<span class="params">$scope, $ionicPopover</span>) </span>{</div><div class="line"></div><div class="line">  $ionicPopover.fromTemplateUrl(<span class="string">&quot;ez-popover.html&quot;</span>, {</div><div class="line">    <span class="attr">scope</span>: $scope</div><div class="line">  })</div><div class="line">  .then(<span class="function"><span class="keyword">function</span>(<span class="params">popover</span>)</span>{</div><div class="line">    $scope.popover = popover;</div><div class="line">  })</div><div class="line">  $scope.openPopover = <span class="function"><span class="keyword">function</span>(<span class="params">$event</span>) </span>{</div><div class="line">    $scope.popover.show($event);</div><div class="line">  };</div><div class="line">  $scope.closePopover = <span class="function"><span class="keyword">function</span>(<span class="params"></span>) </span>{</div><div class="line">    $scope.popover.hide();</div><div class="line">  };</div><div class="line">  <span class="comment">//&#x9500;&#x6BC1;&#x4E8B;&#x4EF6;&#x56DE;&#x8C03;&#x5904;&#x7406;&#xFF1A;&#x6E05;&#x7406;popover&#x5BF9;&#x8C61;</span></div><div class="line">  $scope.$on(<span class="string">&quot;$destroy&quot;</span>, <span class="function"><span class="keyword">function</span>(<span class="params"></span>) </span>{</div><div class="line">    $scope.popover.remove();</div><div class="line">  });</div><div class="line">  <span class="comment">// &#x9690;&#x85CF;&#x4E8B;&#x4EF6;&#x56DE;&#x8C03;&#x5904;&#x7406;</span></div><div class="line">  $scope.$on(<span class="string">&quot;popover.hidden&quot;</span>, <span class="function"><span class="keyword">function</span>(<span class="params"></span>) </span>{</div><div class="line">    <span class="comment">// Execute action</span></div><div class="line">  });</div><div class="line">  <span class="comment">//&#x5220;&#x9664;&#x4E8B;&#x4EF6;&#x56DE;&#x8C03;&#x5904;&#x7406;</span></div><div class="line">  $scope.$on(<span class="string">&quot;popover.removed&quot;</span>, <span class="function"><span class="keyword">function</span>(<span class="params"></span>) </span>{</div><div class="line">    <span class="comment">// Execute action</span></div><div class="line">  });</div><div class="line">});</div></pre></td></tr></table></figure>

      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        
  <div style="padding: 10px 0; margin: 20px auto; width: 90%; text-align: center;">
    <div>感谢您的支持！</div>
    <button id="rewardButton" disable="enable" onclick="var qr = document.getElementById('QR'); if (qr.style.display === 'none') {qr.style.display='block';} else {qr.style.display='none'}">
      <span>打 赏</span>
    </button>
    <div id="QR" style="display: none;">
      
        <div id="wechat" style="display: inline-block">
          <img id="wechat_qr" src="http://ofy7k3v4s.bkt.clouddn.com/wcpayCode.jpg" alt="Hongqin Ma WeChat Pay"/>
          <p>微信打赏</p>
        </div>
      
      
        <div id="alipay" style="display: inline-block">
          <img id="alipay_qr" src="http://ofy7k3v4s.bkt.clouddn.com/apayCode.jpg" alt="Hongqin Ma Alipay"/>
          <p>支付宝打赏</p>
        </div>
      
    </div>
  </div>


      
    </div>

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/ionic/" rel="tag">#ionic</a>
          
        </div>
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2016/12/07/s016-ioionic-css笔记/" rel="next" title="ionic css笔记">
                <i class="fa fa-chevron-left"></i> ionic css笔记
              </a>
            
          </div>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2016/12/14/s016-ionic-cordova-AngularJS混合app开发笔记/" rel="prev" title="ionic+cordova+AngularJS混合app开发笔记">
                ionic+cordova+AngularJS混合app开发笔记 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </article>



    <div class="post-spread">
      
        <div class="ds-share flat" data-thread-key="2016/12/09/s016-ionic-js笔记/"
     data-title="ionic js笔记"
     data-content=""
     data-url="https://hongqinma.github.io/2016/12/09/s016-ionic-js笔记/">
  <div class="ds-share-inline">
    <ul  class="ds-share-icons-16">

      <li data-toggle="ds-share-icons-more"><a class="ds-more" href="javascript:void(0);">分享到：</a></li>
      <li><a class="ds-weibo" href="javascript:void(0);" data-service="weibo">微博</a></li>
      <li><a class="ds-qzone" href="javascript:void(0);" data-service="qzone">QQ空间</a></li>
      <li><a class="ds-qqt" href="javascript:void(0);" data-service="qqt">腾讯微博</a></li>
      <li><a class="ds-wechat" href="javascript:void(0);" data-service="wechat">微信</a></li>

    </ul>
    <div class="ds-share-icons-more">
    </div>
  </div>
</div>
      
    </div>
  </div>


          </div>
          


          
  <div class="comments" id="comments">
    
      <div class="ds-thread" data-thread-key="2016/12/09/s016-ionic-js笔记/"
           data-title="ionic js笔记" data-url="https://hongqinma.github.io/2016/12/09/s016-ionic-js笔记/">
      </div>
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            Table of Contents
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            Overview
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel ">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="//schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="/images/photo.jpg"
               alt="Hongqin Ma" />
          <p class="site-author-name" itemprop="name">Hongqin Ma</p>
          <p class="site-description motion-element" itemprop="description">Spell at all costs， to rush you in the future. </p>
        </div>
        <nav class="site-state motion-element">
          <div class="site-state-item site-state-posts">
            <a href="/archives">
              <span class="site-state-item-count">68</span>
              <span class="site-state-item-name">posts</span>
            </a>
          </div>

          
            <div class="site-state-item site-state-categories">
              <a href="/categories">
                <span class="site-state-item-count">16</span>
                <span class="site-state-item-name">categories</span>
              </a>
            </div>
          

          
            <div class="site-state-item site-state-tags">
              <a href="/tags">
                <span class="site-state-item-count">57</span>
                <span class="site-state-item-name">tags</span>
              </a>
            </div>
          

        </nav>

        

        <div class="links-of-author motion-element">
          
            
              <span class="links-of-author-item">
                <a href="https://github.com/HongqinMa" target="_blank" title="GitHub">
                  
                    <i class="fa fa-fw fa-github"></i>
                  
                  GitHub
                </a>
              </span>
            
              <span class="links-of-author-item">
                <a href="https://twitter.com/HongqinMa" target="_blank" title="Twitter">
                  
                    <i class="fa fa-fw fa-twitter"></i>
                  
                  Twitter
                </a>
              </span>
            
              <span class="links-of-author-item">
                <a href="https://www.facebook.com/profile.php?id=100006581058735" target="_blank" title="Facebook">
                  
                    <i class="fa fa-fw fa-facebook"></i>
                  
                  Facebook
                </a>
              </span>
            
              <span class="links-of-author-item">
                <a href="http://www.zhihu.com/people/HirakuMa" target="_blank" title="知乎">
                  
                    <i class="fa fa-fw fa-share-alt"></i>
                  
                  知乎
                </a>
              </span>
            
          
        </div>

        
        

        
        
          <div class="links-of-blogroll motion-element links-of-blogroll-inline">
            <div class="links-of-blogroll-title">
              <i class="fa  fa-fw fa-globe"></i>
              Links
            </div>
            <ul class="links-of-blogroll-list">
              
                <li class="links-of-blogroll-item">
                  <a href="http://www.cnblogs.com/rubylouvre/" title="司徒正美" target="_blank">司徒正美</a>
                </li>
              
                <li class="links-of-blogroll-item">
                  <a href="http://www.cnblogs.com/sanshi/" title="三生石上" target="_blank">三生石上</a>
                </li>
              
                <li class="links-of-blogroll-item">
                  <a href="http://www.cnblogs.com/TomXu/" title="汤姆大叔" target="_blank">汤姆大叔</a>
                </li>
              
                <li class="links-of-blogroll-item">
                  <a href="http://gold.xitu.io/" title="掘金" target="_blank">掘金</a>
                </li>
              
                <li class="links-of-blogroll-item">
                  <a href="https://segmentfault.com/" title="segmentfault" target="_blank">segmentfault</a>
                </li>
              
                <li class="links-of-blogroll-item">
                  <a href="http://www.jianshu.com/users/1cbb94e5ed4d/latest_articles" title="简书" target="_blank">简书</a>
                </li>
              
                <li class="links-of-blogroll-item">
                  <a href="https://home.cnblogs.com/" title="博客园" target="_blank">博客园</a>
                </li>
              
                <li class="links-of-blogroll-item">
                  <a href="https://www.awesomes.cn/" title="Awesomes" target="_blank">Awesomes</a>
                </li>
              
            </ul>
          </div>
        

      </section>

      
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">
            
              
            
            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#什么是-Ionic-JS"><span class="nav-number">1.</span> <span class="nav-text">什么是 Ionic JS</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#视图导航"><span class="nav-number">2.</span> <span class="nav-text">视图导航</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#ion-nav-view"><span class="nav-number">2.1.</span> <span class="nav-text">ion-nav-view</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#ion-view"><span class="nav-number">2.2.</span> <span class="nav-text">ion-view</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#基本布局"><span class="nav-number">3.</span> <span class="nav-text">基本布局</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#Ion-header-bar"><span class="nav-number">3.1.</span> <span class="nav-text">Ion-header-bar</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#ion-footer-bar"><span class="nav-number">3.2.</span> <span class="nav-text">ion-footer-bar</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#ion-content"><span class="nav-number">3.3.</span> <span class="nav-text">ion-content</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#选项卡"><span class="nav-number">4.</span> <span class="nav-text">选项卡</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#语法"><span class="nav-number">4.1.</span> <span class="nav-text">语法</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#脚本接口：-ionicTabsDelegate"><span class="nav-number">4.2.</span> <span class="nav-text">脚本接口：$ionicTabsDelegate</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#列表"><span class="nav-number">5.</span> <span class="nav-text">列表</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#语法-1"><span class="nav-number">5.1.</span> <span class="nav-text">语法</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#属性"><span class="nav-number">5.2.</span> <span class="nav-text">属性</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#成员按钮"><span class="nav-number">5.3.</span> <span class="nav-text">成员按钮</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#API-ionicListDelegate"><span class="nav-number">5.4.</span> <span class="nav-text">API : $ionicListDelegate</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#表单输入"><span class="nav-number">6.</span> <span class="nav-text">表单输入</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#复选按钮-ion-checkbox"><span class="nav-number">6.1.</span> <span class="nav-text">复选按钮: ion-checkbox</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#单选按钮-ion-radio"><span class="nav-number">6.2.</span> <span class="nav-text">单选按钮:ion-radio</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#开关按钮-ion-toggle"><span class="nav-number">6.3.</span> <span class="nav-text">开关按钮:ion-toggle</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#效果图"><span class="nav-number">7.</span> <span class="nav-text">效果图</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#代码"><span class="nav-number">8.</span> <span class="nav-text">代码</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#幻灯片"><span class="nav-number">9.</span> <span class="nav-text">幻灯片</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#语法-2"><span class="nav-number">9.1.</span> <span class="nav-text">语法</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#属性-1"><span class="nav-number">9.2.</span> <span class="nav-text">属性</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#方法事件"><span class="nav-number">9.3.</span> <span class="nav-text">方法事件</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#API-ionicSlideBoxDelegate"><span class="nav-number">9.4.</span> <span class="nav-text">API:$ionicSlideBoxDelegate</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#动态组件"><span class="nav-number">10.</span> <span class="nav-text">动态组件</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#模态对话框-ionicModal"><span class="nav-number">10.1.</span> <span class="nav-text">模态对话框:$ionicModal</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#1、声明对话框模板"><span class="nav-number">10.1.1.</span> <span class="nav-text">1、声明对话框模板</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#2、创建对话框对象"><span class="nav-number">10.1.2.</span> <span class="nav-text">2、创建对话框对象</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#3、操作对话框对象"><span class="nav-number">10.1.3.</span> <span class="nav-text">3、操作对话框对象</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#4、js代码"><span class="nav-number">10.1.4.</span> <span class="nav-text">4、js代码</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#上拉菜单-ionicActionSheet"><span class="nav-number">10.2.</span> <span class="nav-text">上拉菜单:$ionicActionSheet</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#弹出框-ionicPopup"><span class="nav-number">10.3.</span> <span class="nav-text">弹出框:$ionicPopup</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#浮动框：-ionicPopover"><span class="nav-number">10.4.</span> <span class="nav-text">浮动框：$ionicPopover</span></a></li></ol></li></ol></div>
            
          </div>
        </section>
      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy; 
  <span itemprop="copyrightYear">2016</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Hongqin Ma</span>
</div>

<div class="powered-by">
  Powered by <a class="theme-link" href="https://hexo.io">Hexo</a>
</div>

<div class="theme-info">
  Theme -
  <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
    NexT.Muse
  </a>
</div>

<script async src="https://dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>
<span id="busuanzi_container_site_pv">
    &nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;Page Views: <span id="busuanzi_value_site_pv"></span> 
</span>

        

<div class="busuanzi-count">

  <script async src="https://dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>

  
    <span class="site-uv"><i class="fa fa-user"></i><span class="busuanzi-value" id="busuanzi_value_site_uv"></span></span>
  

  
    <span class="site-pv"><i class="fa fa-eye"></i><span class="busuanzi-value" id="busuanzi_value_site_pv"></span></span>
  
  
</div>



        
      </div>
    </footer>

    <div class="back-to-top">
      <i class="fa fa-arrow-up"></i>
    </div>
  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  



  
  <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.0.2"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.0.2"></script>



  
  

  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.0.2"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.0.2"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.0.2"></script>



  

  
    
  

  <script type="text/javascript">
    var duoshuoQuery = {short_name:"Hiraku"};
    (function() {
      var ds = document.createElement('script');
      ds.type = 'text/javascript';ds.async = true;
      ds.id = 'duoshuo-script';
      ds.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//static.duoshuo.com/embed.js';
      ds.charset = 'UTF-8';
      (document.getElementsByTagName('head')[0]
      || document.getElementsByTagName('body')[0]).appendChild(ds);
    })();
  </script>

  
    
    <script src="/lib/ua-parser-js/dist/ua-parser.min.js?v=0.7.9"></script>
    <script src="/js/src/hook-duoshuo.js"></script>
  






  
  

  

  

  
  <script src="https://cdn1.lncld.net/static/js/av-core-mini-0.6.1.js"></script>
  <script>AV.initialize("PPmoIQxeu8Sd21h6Tl9TthNx-gzGzoHsz", "rTvbY2H7DvWzRipiBwn72RQ4");</script>
  <script>
    function showTime(Counter) {
      var query = new AV.Query(Counter);
      var entries = [];
      var $visitors = $(".leancloud_visitors");

      $visitors.each(function () {
        entries.push( $(this).attr("id").trim() );
      });

      query.containedIn('url', entries);
      query.find()
        .done(function (results) {
          var COUNT_CONTAINER_REF = '.leancloud-visitors-count';

          if (results.length === 0) {
            $visitors.find(COUNT_CONTAINER_REF).text(0);
            return;
          }

          for (var i = 0; i < results.length; i++) {
            var item = results[i];
            var url = item.get('url');
            var time = item.get('time');
            var element = document.getElementById(url);

            $(element).find(COUNT_CONTAINER_REF).text(time);
          }
          for(var i = 0; i < entries.length; i++) {
            var url = entries[i];
            var element = document.getElementById(url);
            var countSpan = $(element).find(COUNT_CONTAINER_REF);
            if( countSpan.text() == '') {
              countSpan.text(0);
            }
          }
        })
        .fail(function (object, error) {
          console.log("Error: " + error.code + " " + error.message);
        });
    }

    function addCount(Counter) {
      var $visitors = $(".leancloud_visitors");
      var url = $visitors.attr('id').trim();
      var title = $visitors.attr('data-flag-title').trim();
      var query = new AV.Query(Counter);

      query.equalTo("url", url);
      query.find({
        success: function(results) {
          if (results.length > 0) {
            var counter = results[0];
            counter.fetchWhenSave(true);
            counter.increment("time");
            counter.save(null, {
              success: function(counter) {
                var $element = $(document.getElementById(url));
                $element.find('.leancloud-visitors-count').text(counter.get('time'));
              },
              error: function(counter, error) {
                console.log('Failed to save Visitor num, with error message: ' + error.message);
              }
            });
          } else {
            var newcounter = new Counter();
            /* Set ACL */
            var acl = new AV.ACL();
            acl.setPublicReadAccess(true);
            acl.setPublicWriteAccess(true);
            newcounter.setACL(acl);
            /* End Set ACL */
            newcounter.set("title", title);
            newcounter.set("url", url);
            newcounter.set("time", 1);
            newcounter.save(null, {
              success: function(newcounter) {
                var $element = $(document.getElementById(url));
                $element.find('.leancloud-visitors-count').text(newcounter.get('time'));
              },
              error: function(newcounter, error) {
                console.log('Failed to create');
              }
            });
          }
        },
        error: function(error) {
          console.log('Error:' + error.code + " " + error.message);
        }
      });
    }

    $(function() {
      var Counter = AV.Object.extend("Counter");
      if ($('.leancloud_visitors').length == 1) {
        addCount(Counter);
      } else if ($('.post-title-link').length > 1) {
        showTime(Counter);
      }
    });
  </script>



  

  

  
  
  <!-- custom analytics part create by xiamo -->
<script src="https://cdn1.lncld.net/static/js/av-core-mini-0.6.1.js"></script>
<script>AV.initialize("PPmoIQxeu8Sd21h6Tl9TthNx-gzGzoHsz", "rTvbY2H7DvWzRipiBwn72RQ4");</script>
<script>
function showTime(Counter) {
  var query = new AV.Query(Counter);
  $(".leancloud_visitors").each(function() {
    var url = $(this).attr("id").trim();
    query.equalTo("url", url);
    query.find({
      success: function(results) {
        if (results.length == 0) {
          var content = '0 ' + $(document.getElementById(url)).text();
          $(document.getElementById(url)).text(content);
          return;
        }
        for (var i = 0; i < results.length; i++) {
          var object = results[i];
          var content = object.get('time') + ' ' + $(document.getElementById(url)).text();
          $(document.getElementById(url)).text(content);
        }
      },
      error: function(object, error) {
        console.log("Error: " + error.code + " " + error.message);
      }
    });

  });
}

function addCount(Counter) {
  var Counter = AV.Object.extend("Counter");
  url = $(".leancloud_visitors").attr('id').trim();
  title = $(".leancloud_visitors").attr('data-flag-title').trim();
  var query = new AV.Query(Counter);
  query.equalTo("url", url);
  query.find({
    success: function(results) {
      if (results.length > 0) {
        var counter = results[0];
        counter.fetchWhenSave(true);
        counter.increment("time");
        counter.save(null, {
          success: function(counter) {
            var content =  counter.get('time') + ' ' + $(document.getElementById(url)).text();
            $(document.getElementById(url)).text(content);
          },
          error: function(counter, error) {
            console.log('Failed to save Visitor num, with error message: ' + error.message);
          }
        });
      } else {
        var newcounter = new Counter();
        newcounter.set("title", title);
        newcounter.set("url", url);
        newcounter.set("time", 1);
        newcounter.save(null, {
          success: function(newcounter) {
              console.log("newcounter.get('time')="+newcounter.get('time'));
            var content = newcounter.get('time') + ' ' + $(document.getElementById(url)).text();
            $(document.getElementById(url)).text(content);
          },
          error: function(newcounter, error) {
            console.log('Failed to create');
          }
        });
      }
    },
    error: function(error) {
      console.log('Error:' + error.code + " " + error.message);
    }
  });
}
$(function() {
  var Counter = AV.Object.extend("Counter");
  if ($('.leancloud_visitors').length == 1) {
    addCount(Counter);
  } else if ($('.post-title-link').length > 1) {
    showTime(Counter);
  }
}); 
</script>

  
</body>
</html>
